cpw.qulogic.msnp16: 8b27f5bb: msn: Delete msn_cmdproc_send since it ju...

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


-----------------------------------------------------------------
Revision: 8b27f5bbd55debf52c19439090df9656eba62cf2
Ancestor: 9ce07ed98780b6dfac98f08e3d9d75f048627a23
Author: masca at cpw.pidgin.im
Date: 2010-03-10T21:46:37
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/8b27f5bbd55debf52c19439090df9656eba62cf2

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/state.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/cmdproc.c	96ba9eae5082f50237290155292346eaa68cf876
+++ libpurple/protocols/msn/cmdproc.c	63eb35c9ccab5d04c5c249b77687bd68a854576e
@@ -195,34 +195,7 @@ msn_cmdproc_send_quick(MsnCmdProc *cmdpr
 	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,
 							int payload_len)
============================================================
--- libpurple/protocols/msn/cmdproc.h	ef09f1e07de96566298363cb0bb807fb6a951cae
+++ libpurple/protocols/msn/cmdproc.h	50d39f110f73f6fce0697683df4c45fa886b9c67
@@ -91,16 +91,6 @@ void msn_cmdproc_queue_trans(MsnCmdProc 
 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, ...);
 
============================================================
--- libpurple/protocols/msn/msn.c	965a5bfb79830322ee62fae958a7286c6930e5c9
+++ libpurple/protocols/msn/msn.c	e8415ca4dc70485fbbdc3417d88734adef0a723d
@@ -200,6 +200,7 @@ msn_act_id(PurpleConnection *gc, const c
 {
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	const char *alias;
 
@@ -227,7 +228,9 @@ msn_act_id(PurpleConnection *gc, const c
 		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 @@ msn_set_prp(PurpleConnection *gc, const 
 {
 	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 @@ msn_send_privacy(PurpleConnection *gc)
 	PurpleAccount *account;
 	MsnSession *session;
 	MsnCmdProc *cmdproc;
+	MsnTransaction *trans;
 
 	account = purple_connection_get_account(gc);
 	session = gc->proto_data;
@@ -650,9 +656,11 @@ msn_send_privacy(PurpleConnection *gc)
 
 	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
============================================================
--- libpurple/protocols/msn/notification.c	aff1032186b600f40ac2b5e5340a3e2760780106
+++ libpurple/protocols/msn/notification.c	47087aa10dc52389bd1964192fb5f0274e0b4a7e
@@ -93,6 +93,7 @@ connect_cb(MsnServConn *servconn)
 {
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	GString *vers;
 	const char *ver_str;
@@ -118,7 +119,8 @@ connect_cb(MsnServConn *servconn)
 
 	/* 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
 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 
 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
+	MsnTransaction *trans;
 	PurpleAccount *account;
 	gboolean protocol_supported = FALSE;
 	int proto_ver;
@@ -271,9 +279,10 @@ ver_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	 * 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);
 }
 
 /**************************************************************************
============================================================
--- libpurple/protocols/msn/state.c	7abd0deafd68daf67b5352b21cdc980f7f2ce2d6
+++ libpurple/protocols/msn/state.c	fb1f73cfba4633a21404d40e913f0c8910f53f21
@@ -201,6 +201,7 @@ msn_change_status(MsnSession *session)
 {
 	PurpleAccount *account;
 	MsnCmdProc *cmdproc;
+	MsnTransaction *trans;
 	MsnUser *user;
 	MsnObject *msnobj;
 	const char *state_text;
@@ -245,9 +246,9 @@ msn_change_status(MsnSession *session)
 	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 @@ msn_change_status(MsnSession *session)
 		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 *


More information about the Commits mailing list