changeset 30711:54c8aeecab4c

We need a way to send commands without transaction ID
author masca@cpw.pidgin.im
date Thu, 11 Mar 2010 17:59:53 +0000
parents f7ee91763c6b
children b3b7b537284f
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
diffstat 5 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Wed Mar 10 22:16:04 2010 +0000
+++ b/libpurple/protocols/msn/msn.c	Thu Mar 11 17:59:53 2010 +0000
@@ -1972,7 +1972,8 @@
 
 		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);
 	}
 }
--- a/libpurple/protocols/msn/notification.c	Wed Mar 10 22:16:04 2010 +0000
+++ b/libpurple/protocols/msn/notification.c	Thu Mar 11 17:59:53 2010 +0000
@@ -312,6 +312,7 @@
 		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);
--- a/libpurple/protocols/msn/switchboard.c	Wed Mar 10 22:16:04 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Thu Mar 11 17:59:53 2010 +0000
@@ -1225,7 +1225,8 @@
 		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);
--- a/libpurple/protocols/msn/transaction.c	Wed Mar 10 22:16:04 2010 +0000
+++ b/libpurple/protocols/msn/transaction.c	Thu Mar 11 17:59:53 2010 +0000
@@ -37,6 +37,7 @@
 
 	trans->cmdproc = cmdproc;
 	trans->command = g_strdup(command);
+	trans->send_trId = TRUE;
 
 	if (format != NULL)
 	{
@@ -96,8 +97,10 @@
 
 	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
+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)
 {
--- a/libpurple/protocols/msn/transaction.h	Wed Mar 10 22:16:04 2010 +0000
+++ b/libpurple/protocols/msn/transaction.h	Thu Mar 11 17:59:53 2010 +0000
@@ -41,6 +41,7 @@
 {
 	MsnCmdProc *cmdproc;
 	unsigned int trId;
+	gboolean send_trId;
 
 	char *command;
 	char *params;
@@ -74,6 +75,7 @@
 								 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);