cpw.qulogic.msnp16: cb9d3322: We need a way to send commands without t...

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


-----------------------------------------------------------------
Revision: cb9d3322c1874bfd71aafac6df922617d6312644
Ancestor: 6a60f4c6d7e43a983f441658970659571abf105e
Author: masca at cpw.pidgin.im
Date: 2010-03-11T17:59:53
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/cb9d3322c1874bfd71aafac6df922617d6312644

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

ChangeLog: 

We need a way to send commands without transaction ID

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	66f8abd16e94dddd094655102e0c8e4091d2712d
+++ libpurple/protocols/msn/msn.c	a53b7c44f59a8ca2a48a66b2078795df80ce2e54
@@ -1972,7 +1972,8 @@ msn_keepalive(PurpleConnection *gc)
 
 		cmdproc = session->notification->cmdproc;
 
-		trans = msn_transaction_new(cmdproc, "PNG", NULL, NULL);
+		trans = msn_transaction_new(cmdproc, "PNG", NULL);
+		msn_transaction_set_send_trId(trans, FALSE);
 		msn_cmdproc_send_trans(cmdproc, trans);
 	}
 }
============================================================
--- libpurple/protocols/msn/notification.c	815873fcecd72cf6c4746875be3801a1140d3262
+++ libpurple/protocols/msn/notification.c	295ca84645a68f070e9591264a15394b122b2344
@@ -312,6 +312,7 @@ msn_notification_close(MsnNotification *
 		return;
 
 	trans = msn_transaction_new(notification->cmdproc, "OUT", NULL, NULL);
+	msn_transaction_set_send_trId(trans, FALSE);
 	msn_cmdproc_send_trans(notification->cmdproc, trans);
 
 	msn_notification_disconnect(notification);
============================================================
--- libpurple/protocols/msn/switchboard.c	bdff324b61794d22d1df0ea08c7849b844e07d7b
+++ libpurple/protocols/msn/switchboard.c	ba691322308974414f1e13a593b3e362728c3c8f
@@ -1225,7 +1225,8 @@ msn_switchboard_close(MsnSwitchBoard *sw
 		MsnCmdProc *cmdproc;
 		MsnTransaction *trans;
 		cmdproc = swboard->cmdproc;
-		trans = msn_transaction_new(cmdproc, "OUT", NULL, NULL);
+		trans = msn_transaction_new(cmdproc, "OUT", NULL);
+		msn_transaction_set_send_trId(trans, FALSE);
 		msn_cmdproc_send_trans(cmdproc, trans);
 
 		msn_switchboard_destroy(swboard);
============================================================
--- libpurple/protocols/msn/transaction.c	ca020d0b8f923338a86e8bef54fd2591b5cc15dd
+++ libpurple/protocols/msn/transaction.c	4f2dbba26e272795d691dda0335ee8d807cfcbe1
@@ -37,6 +37,7 @@ msn_transaction_new(MsnCmdProc *cmdproc,
 
 	trans->cmdproc = cmdproc;
 	trans->command = g_strdup(command);
+	trans->send_trId = TRUE;
 
 	if (format != NULL)
 	{
@@ -96,8 +97,10 @@ msn_transaction_to_string(MsnTransaction
 
 	if (trans->params != NULL)
 		str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params);
+	else if (trans->send_trId)
+		str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId);
 	else
-		str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId);
+		str = g_strdup_printf("%s\r\n", trans->command);
 
 	return str;
 }
@@ -175,6 +178,14 @@ void
 }
 
 void
+msn_transaction_set_send_trId(MsnTransaction  *trans, gboolean send)
+{
+	g_return_if_fail(trans != NULL);
+
+	trans->send_trId = send;
+}
+
+void
 msn_transaction_add_cb(MsnTransaction *trans, char *answer,
 					   MsnTransCb cb)
 {
============================================================
--- libpurple/protocols/msn/transaction.h	5c879d6d9025c1bd4fd82b1d4cab151b26ae8c33
+++ libpurple/protocols/msn/transaction.h	6cfdac0a7add1e7b25e176adacb84a8712e59209
@@ -41,6 +41,7 @@ struct _MsnTransaction
 {
 	MsnCmdProc *cmdproc;
 	unsigned int trId;
+	gboolean send_trId;
 
 	char *command;
 	char *params;
@@ -74,6 +75,7 @@ void msn_transaction_set_data_free(MsnTr
 								 const char *payload, int payload_len);
 void msn_transaction_set_data(MsnTransaction *trans, void *data);
 void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn);
+void msn_transaction_set_send_trId(MsnTransaction  *trans, gboolean send);
 void msn_transaction_add_cb(MsnTransaction *trans, char *answer,
 							MsnTransCb cb);
 void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb);


More information about the Commits mailing list