changeset 31147:4d7dfeae29c6

msn: Delete msn_cmdproc_send since it just have duplicated code from msn_transaction_new. I have replaced any msn_cmdproc_send with a proper msn_transaction_new and msn_cmdproc_send_trans combo.
author masca@cpw.pidgin.im
date Wed, 10 Mar 2010 21:46:37 +0000
parents 9a86ddd0914e
children f7ee91763c6b
files libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/cmdproc.h libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/state.c
diffstat 5 files changed, 34 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c	Wed Mar 10 17:58:21 2010 +0000
+++ b/libpurple/protocols/msn/cmdproc.c	Wed Mar 10 21:46:37 2010 +0000
@@ -195,33 +195,6 @@
 	g_free(data);
 }
 
-void
-msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command,
-				 const char *format, ...)
-{
-	MsnTransaction *trans;
-	va_list arg;
-
-	g_return_if_fail(cmdproc != NULL);
-	g_return_if_fail(command != NULL);
-
-	if (!cmdproc->servconn->connected)
-		return;
-
-	trans = g_new0(MsnTransaction, 1);
-
-	trans->cmdproc = cmdproc;
-	trans->command = g_strdup(command);
-
-	if (format != NULL)
-	{
-		va_start(arg, format);
-		trans->params = g_strdup_vprintf(format, arg);
-		va_end(arg);
-	}
-
-	msn_cmdproc_send_trans(cmdproc, trans);
-}
 
 void
 msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload,
--- a/libpurple/protocols/msn/cmdproc.h	Wed Mar 10 17:58:21 2010 +0000
+++ b/libpurple/protocols/msn/cmdproc.h	Wed Mar 10 21:46:37 2010 +0000
@@ -91,16 +91,6 @@
 void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc,
 							 MsnTransaction *trans);
 
-/**
- * This function is just a wrapper that creates a MsnTransaction
- * and send it.
- *
- * @param cmdproc 	The MsnCmdProc to be attached to the MsnTransaction.
- * @param command 	The command to use in this transaction.
- * @param format 	The payload format.
- */
-void msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command,
-					  const char *format, ...);
 void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command,
 							const char *format, ...);
 
--- a/libpurple/protocols/msn/msn.c	Wed Mar 10 17:58:21 2010 +0000
+++ b/libpurple/protocols/msn/msn.c	Wed Mar 10 21:46:37 2010 +0000
@@ -200,6 +200,7 @@
 {
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	const char *alias;
 
@@ -227,7 +228,9 @@
 		alias = purple_url_encode(purple_account_get_username(account));
 	}
 
-	msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias);
+	trans = msn_transaction_new(cmdproc, "PRP", "MFN %s", alias);
+
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 static void
@@ -235,19 +238,21 @@
 {
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
+	MsnTransaction *trans;
 
 	session = gc->proto_data;
 	cmdproc = session->notification->cmdproc;
 
 	if (entry == NULL || *entry == '\0')
 	{
-		msn_cmdproc_send(cmdproc, "PRP", "%s", type);
+		trans = msn_transaction_new(cmdproc, "PRP", "%s", type);
 	}
 	else
 	{
-		msn_cmdproc_send(cmdproc, "PRP", "%s %s", type,
+		trans = msn_transaction_new(cmdproc, "PRP", "%s %s", type,
 						 purple_url_encode(entry));
 	}
+		msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 static void
@@ -643,6 +648,7 @@
 	PurpleAccount *account;
 	MsnSession *session;
 	MsnCmdProc *cmdproc;
+	MsnTransaction *trans;
 
 	account = purple_connection_get_account(gc);
 	session = gc->proto_data;
@@ -650,9 +656,11 @@
 
 	if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL ||
 	    account->perm_deny == PURPLE_PRIVACY_DENY_USERS)
-		msn_cmdproc_send(cmdproc, "BLP", "%s", "AL");
+		trans = msn_transaction_new(cmdproc, "BLP", "%s", "AL");
 	else
-		msn_cmdproc_send(cmdproc, "BLP", "%s", "BL");
+		trans = msn_transaction_new(cmdproc, "BLP", "%s", "BL");
+
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 static void
--- a/libpurple/protocols/msn/notification.c	Wed Mar 10 17:58:21 2010 +0000
+++ b/libpurple/protocols/msn/notification.c	Wed Mar 10 21:46:37 2010 +0000
@@ -93,6 +93,7 @@
 {
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	GString *vers;
 	const char *ver_str;
@@ -118,7 +119,8 @@
 
 	/* Skip the initial space */
 	ver_str = (vers->str + 1);
-	msn_cmdproc_send(cmdproc, "VER", "%s", ver_str);
+	trans = msn_transaction_new(cmdproc, "VER", "%s", ver_str);
+	msn_cmdproc_send_trans(cmdproc, trans);
 
 	g_string_free(vers, TRUE);
 }
@@ -157,25 +159,30 @@
 msn_got_login_params(MsnSession *session, const char *ticket, const char *response)
 {
 	MsnCmdProc *cmdproc;
+	MsnTransaction *trans;
 
 	cmdproc = session->notification->cmdproc;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END);
 
 	if (session->protocol_ver >= 16)
-		msn_cmdproc_send(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid);
+		trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid);
 	else
-		msn_cmdproc_send(cmdproc, "USR", "SSO S %s %s", ticket, response);
+		trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s", ticket, response);
+
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 static void
 cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	PurpleAccount *account;
+	MsnTransaction *trans;
 
 	account = cmdproc->session->account;
 
-	msn_cmdproc_send(cmdproc, "USR", "SSO I %s", purple_account_get_username(account));
+	trans = msn_transaction_new(cmdproc, "USR", "SSO I %s", purple_account_get_username(account));
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 static void
@@ -235,6 +242,7 @@
 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	gboolean protocol_supported = FALSE;
 	int proto_ver;
@@ -271,9 +279,10 @@
 	 * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx
 	 * to see the Local ID
 	 */
-	msn_cmdproc_send(cmdproc, "CVR",
+	trans = msn_transaction_new(cmdproc, "CVR",
 					"0x0409 winnt 5.1 i386 MSNMSGR 8.5.1302 BC01 %s",
 					 purple_account_get_username(account));
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 /**************************************************************************
--- a/libpurple/protocols/msn/state.c	Wed Mar 10 17:58:21 2010 +0000
+++ b/libpurple/protocols/msn/state.c	Wed Mar 10 21:46:37 2010 +0000
@@ -201,6 +201,7 @@
 {
 	PurpleAccount *account;
 	MsnCmdProc *cmdproc;
+	MsnTransaction *trans;
 	MsnUser *user;
 	MsnObject *msnobj;
 	const char *state_text;
@@ -245,9 +246,9 @@
 	if (msnobj == NULL)
 	{
 		if (session->protocol_ver >= 16)
-			msn_cmdproc_send(cmdproc, "CHG", "%s %u:%02u 0", state_text, caps, MSN_CLIENT_ID_EXT_CAPS);
+			trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u 0", state_text, caps, MSN_CLIENT_ID_EXT_CAPS);
 		else
-			msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, caps);
+			trans = msn_transaction_new(cmdproc, "CHG", "%s %d", state_text, caps);
 	}
 	else
 	{
@@ -256,14 +257,16 @@
 		msnobj_str = msn_object_to_string(msnobj);
 
 		if (session->protocol_ver >= 16)
-			msn_cmdproc_send(cmdproc, "CHG", "%s %u:%02u %s", state_text,
+			trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u %s", state_text,
 							 caps, MSN_CLIENT_ID_EXT_CAPS, purple_url_encode(msnobj_str));
 		else
-			msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text,
+			trans = msn_transaction_new(cmdproc, "CHG", "%s %d %s", state_text,
 							 caps, purple_url_encode(msnobj_str));
 
 		g_free(msnobj_str);
 	}
+
+	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
 const char *