cpw.qulogic.msnp16: 6a60f4c6: msn: Remove msn_cmdproc_send_quick in fa...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Mar 11 13:20:43 EST 2010


-----------------------------------------------------------------
Revision: 6a60f4c6d7e43a983f441658970659571abf105e
Ancestor: 8b27f5bbd55debf52c19439090df9656eba62cf2
Author: masca at cpw.pidgin.im
Date: 2010-03-10T22:16:04
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/6a60f4c6d7e43a983f441658970659571abf105e

Modified files:
        libpurple/protocols/msn/cmdproc.c
        libpurple/protocols/msn/cmdproc.h
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/switchboard.c

ChangeLog: 

msn: Remove msn_cmdproc_send_quick in favor of msn_cmdproc_send_trans

With this changes whe have an unified and robust way to send commands.
We avoid duplicated code and it's easier to find problems since the code is only
in one place.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/cmdproc.c	63eb35c9ccab5d04c5c249b77687bd68a854576e
+++ libpurple/protocols/msn/cmdproc.c	9b4e46a60fd3ec6b7c9182486d54616541b621f1
@@ -155,48 +155,6 @@ void
 }
 
 void
-msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command,
-					   const char *format, ...)
-{
-	MsnServConn *servconn;
-	char *data;
-	char *params = NULL;
-	va_list arg;
-	size_t len;
-
-	g_return_if_fail(cmdproc != NULL);
-	g_return_if_fail(command != NULL);
-
-	servconn = cmdproc->servconn;
-
-	if (!servconn->connected)
-		return;
-
-	if (format != NULL)
-	{
-		va_start(arg, format);
-		params = g_strdup_vprintf(format, arg);
-		va_end(arg);
-	}
-
-	if (params != NULL)
-		data = g_strdup_printf("%s %s\r\n", command, params);
-	else
-		data = g_strdup_printf("%s\r\n", command);
-
-	g_free(params);
-
-	len = strlen(data);
-
-	show_debug_cmd(cmdproc, FALSE, data);
-
-	msn_servconn_write(servconn, data, len);
-
-	g_free(data);
-}
-
-
-void
 msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload,
 							int payload_len)
 {
============================================================
--- libpurple/protocols/msn/cmdproc.h	50d39f110f73f6fce0697683df4c45fa886b9c67
+++ libpurple/protocols/msn/cmdproc.h	88864cdfcd23351c50c00963e4b3d740935a45ff
@@ -91,9 +91,6 @@ void msn_cmdproc_queue_trans(MsnCmdProc 
 void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc,
 							 MsnTransaction *trans);
 
-void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command,
-							const char *format, ...);
-
 void msn_cmdproc_process_msg(MsnCmdProc *cmdproc,
 							 MsnMessage *msg);
 void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd);
============================================================
--- libpurple/protocols/msn/msn.c	e8415ca4dc70485fbbdc3417d88734adef0a723d
+++ libpurple/protocols/msn/msn.c	66f8abd16e94dddd094655102e0c8e4091d2712d
@@ -1962,6 +1962,7 @@ msn_keepalive(PurpleConnection *gc)
 msn_keepalive(PurpleConnection *gc)
 {
 	MsnSession *session;
+	MsnTransaction *trans;
 
 	session = gc->proto_data;
 
@@ -1971,7 +1972,8 @@ msn_keepalive(PurpleConnection *gc)
 
 		cmdproc = session->notification->cmdproc;
 
-		msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL);
+		trans = msn_transaction_new(cmdproc, "PNG", NULL, NULL);
+		msn_cmdproc_send_trans(cmdproc, trans);
 	}
 }
 
============================================================
--- libpurple/protocols/msn/notification.c	47087aa10dc52389bd1964192fb5f0274e0b4a7e
+++ libpurple/protocols/msn/notification.c	815873fcecd72cf6c4746875be3801a1140d3262
@@ -304,12 +304,15 @@ msn_notification_close(MsnNotification *
 void
 msn_notification_close(MsnNotification *notification)
 {
+	MsnTransaction *trans;
+
 	g_return_if_fail(notification != NULL);
 
 	if (!notification->in_use)
 		return;
 
-	msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL);
+	trans = msn_transaction_new(notification->cmdproc, "OUT", NULL, NULL);
+	msn_cmdproc_send_trans(notification->cmdproc, trans);
 
 	msn_notification_disconnect(notification);
 }
============================================================
--- libpurple/protocols/msn/switchboard.c	4ef06caca222d5352c35e570c8fb04eb7fb1c897
+++ libpurple/protocols/msn/switchboard.c	bdff324b61794d22d1df0ea08c7849b844e07d7b
@@ -1223,8 +1223,10 @@ msn_switchboard_close(MsnSwitchBoard *sw
 			 !swboard->session->connected)
 	{
 		MsnCmdProc *cmdproc;
+		MsnTransaction *trans;
 		cmdproc = swboard->cmdproc;
-		msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL);
+		trans = msn_transaction_new(cmdproc, "OUT", NULL, NULL);
+		msn_cmdproc_send_trans(cmdproc, trans);
 
 		msn_switchboard_destroy(swboard);
 	}


More information about the Commits mailing list