changeset 31349:6d99f7cdc654

merge of '833313a684a714d5138a37f30a635c00044f3b93' and 'd54eb6748669c3887900b9d4c71e351e7281e41e'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 06 Nov 2010 03:46:35 +0000
parents 58b013a3a2d4 (current diff) b09ec659a9f5 (diff)
children 0462bec07414 a4f3d21f393c f2e0b8f38e14
files libpurple/protocols/msn/switchboard.c
diffstat 7 files changed, 34 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/cmdproc.c	Sat Nov 06 03:46:35 2010 +0000
@@ -211,37 +211,39 @@
 
 				MsnMessage *first = g_hash_table_lookup(cmdproc->multiparts, message_id);
 				chunk = strtol(chunk_text, NULL, 10);
-				if (first == NULL) {
+				if (first != NULL) {
+					if (first->received_chunks != chunk) {
+						/*
+						 * We received an out of order chunk number (i.e. not the
+						 * next one in the sequence).  Not sure if this can happen
+						 * legitimately, but we definitely don't handle it right
+						 * now.
+						 */
+						g_hash_table_remove(cmdproc->multiparts, message_id);
+						return;
+					}
+
+					/* Chunk is from 1 to total-1 (doesn't count first one) */
+					purple_debug_info("msn", "Received chunk %d of %d, message_id: '%s'\n",
+							chunk + 1, first->total_chunks, message_id);
+					first->body = g_realloc(first->body, first->body_len + msg->body_len);
+					memcpy(first->body + first->body_len, msg->body, msg->body_len);
+					first->body_len += msg->body_len;
+					first->received_chunks++;
+					if (first->received_chunks != first->total_chunks)
+						/* We're waiting for more chunks */
+						return;
+
+					/*
+					 * We have all the chunks for this message, great!  Send
+					 * it along... The caller takes care of freeing the old one.
+					 */
+					msg = first;
+				} else {
 					purple_debug_error("msn",
 					                   "Unable to find first chunk of message_id '%s' to correspond with chunk %d.\n",
 					                   message_id, chunk + 1);
-				} else if (first->received_chunks != chunk) {
-					/*
-					 * We received an out of order chunk number (i.e. not the
-					 * next one in the sequence).  Not sure if this can happen
-					 * legitimately, but we definitely don't handle it right
-					 * now.
-					 */
-					g_hash_table_remove(cmdproc->multiparts, message_id);
-					return;
 				}
-
-				/* Chunk is from 1 to total-1 (doesn't count first one) */
-				purple_debug_info("msn", "Received chunk %d of %d, message_id: '%s'\n",
-						chunk + 1, first->total_chunks, message_id);
-				first->body = g_realloc(first->body, first->body_len + msg->body_len);
-				memcpy(first->body + first->body_len, msg->body, msg->body_len);
-				first->body_len += msg->body_len;
-				first->received_chunks++;
-				if (first->received_chunks != first->total_chunks)
-					/* We're waiting for more chunks */
-					return;
-
-				/*
-				 * We have all the chunks for this message, great!  Send
-				 * it along... The caller takes care of freeing the old one.
-				 */
-				msg = first;
 			} else {
 				purple_debug_error("msn", "Received MessageId '%s' with no chunk number!\n", message_id);
 			}
--- a/libpurple/protocols/msn/msg.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/msg.c	Sat Nov 06 03:46:35 2010 +0000
@@ -916,8 +916,6 @@
 {
 	MsnSession *session;
 	MsnSlpLink *slplink;
-	const char *data;
-	gsize len;
 
 	session = cmdproc->servconn->session;
 	slplink = msn_session_get_slplink(session, msg->remote_user);
@@ -940,8 +938,6 @@
 		}
 	}
 
-	data = msn_message_get_bin_data(msg, &len);
-
 	if (msg->part) {
 		msn_slplink_process_msg(slplink, msg->part);
 	}
--- a/libpurple/protocols/msn/notification.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat Nov 06 03:46:35 2010 +0000
@@ -95,7 +95,6 @@
 	MsnCmdProc *cmdproc;
 	MsnSession *session;
 	MsnTransaction *trans;
-	PurpleAccount *account;
 	GString *vers;
 	const char *ver_str;
 	int i;
@@ -104,7 +103,6 @@
 
 	cmdproc = servconn->cmdproc;
 	session = servconn->session;
-	account = session->account;
 
 	vers = g_string_new("");
 
@@ -189,11 +187,7 @@
 static void
 usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
-	MsnSession *session;
-	PurpleAccount *account;
-
-	session = cmdproc->session;
-	account = session->account;
+	MsnSession *session = cmdproc->session;
 
 	if (!g_ascii_strcasecmp(cmd->params[1], "OK"))
 	{
@@ -732,11 +726,8 @@
 	for (domain_node = xmlnode_get_child(root, "d");
 	     domain_node;
 	     domain_node = xmlnode_get_next_twin(domain_node)) {
-		const gchar * domain = NULL;
 		xmlnode *contact_node = NULL;
 
-		domain = xmlnode_get_attrib(domain_node, "n");
-
 		for (contact_node = xmlnode_get_child(domain_node, "c");
 		     contact_node;
 		     contact_node = xmlnode_get_next_twin(contact_node)) {
@@ -1021,8 +1012,6 @@
 iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
-	PurpleAccount *account;
-	PurpleConnection *gc;
 	MsnUser *user;
 	MsnObject *msnobj = NULL;
 	unsigned long clientid, extcaps;
@@ -1032,8 +1021,6 @@
 	char *friendly;
 
 	session = cmdproc->session;
-	account = session->account;
-	gc = purple_account_get_connection(account);
 
 	state    = cmd->params[1];
 	passport = cmd->params[2];
@@ -1246,8 +1233,6 @@
 nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
-	PurpleAccount *account;
-	PurpleConnection *gc;
 	MsnUser *user;
 	MsnObject *msnobj;
 	unsigned long clientid, extcaps;
@@ -1256,8 +1241,6 @@
 	const char *state, *passport, *friendly;
 
 	session = cmdproc->session;
-	account = session->account;
-	gc = purple_account_get_connection(account);
 
 	state    = cmd->params[0];
 	passport = cmd->params[1];
@@ -1455,7 +1438,7 @@
 	swboard = msn_switchboard_new(session);
 
 	msn_switchboard_set_invited(swboard, TRUE);
-	msn_switchboard_set_session_id(swboard, cmd->params[0]);
+	msn_switchboard_set_session_id(swboard, session_id);
 	msn_switchboard_set_auth_key(swboard, cmd->params[3]);
 	swboard->im_user = g_strdup(cmd->params[4]);
 	/* msn_switchboard_add_user(swboard, cmd->params[4]); */
@@ -1696,14 +1679,12 @@
 			 size_t len)
 {
 	MsnSession *session;
-	PurpleAccount *account;
 	MsnUser *user;
 	const char *passport;
 	xmlnode *payloadNode;
 	char *psm_str, *str;
 
 	session = cmdproc->session;
-	account = session->account;
 
 	passport = cmd->params[0];
 	if (g_str_equal(passport, session->user->passport))
--- a/libpurple/protocols/msn/slp.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/slp.c	Sat Nov 06 03:46:35 2010 +0000
@@ -118,7 +118,6 @@
 got_user_display(MsnSlpCall *slpcall,
 				 const guchar *data, gsize size)
 {
-	MsnUserList *userlist;
 	const char *info;
 	PurpleAccount *account;
 
@@ -128,7 +127,6 @@
 	if (purple_debug_is_verbose())
 		purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
 
-	userlist = slpcall->slplink->session->userlist;
 	account = slpcall->slplink->session->account;
 
 	purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
@@ -198,7 +196,7 @@
 	MsnSession *session;
 	MsnObject *my_obj = NULL;
 	gconstpointer data = NULL;
-	const char *info;
+	const char *info = NULL;
 	size_t len = 0;
 
 	if (purple_debug_is_verbose())
--- a/libpurple/protocols/msn/slpcall.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Sat Nov 06 03:46:35 2010 +0000
@@ -567,8 +567,7 @@
 
 	} else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) {
 		purple_debug_info("msn", "Cam request.\n");
-		if (slpcall && slpcall->slplink &&
-				slpcall->slplink->session) {
+		if (slpcall->slplink && slpcall->slplink->session) {
 			PurpleConversation *conv;
 			gchar *from = slpcall->slplink->remote_user;
 			conv = purple_find_conversation_with_account(
@@ -590,8 +589,7 @@
 
 	} else if (!strcmp(euf_guid, MSN_CAM_GUID)) {
 		purple_debug_info("msn", "Cam invite.\n");
-		if (slpcall && slpcall->slplink &&
-				slpcall->slplink->session) {
+		if (slpcall->slplink && slpcall->slplink->session) {
 			PurpleConversation *conv;
 			gchar *from = slpcall->slplink->remote_user;
 			conv = purple_find_conversation_with_account(
--- a/libpurple/protocols/msn/switchboard.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sat Nov 06 03:46:35 2010 +0000
@@ -677,11 +677,9 @@
 iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	PurpleAccount *account;
-	PurpleConnection *gc;
 	MsnSwitchBoard *swboard;
 
 	account = cmdproc->session->account;
-	gc = account->gc;
 	swboard = cmdproc->data;
 
 	swboard->total_users = atoi(cmd->params[2]);
@@ -694,7 +692,6 @@
 {
 	MsnSession *session;
 	PurpleAccount *account;
-	PurpleConnection *gc;
 	MsnSwitchBoard *swboard;
 	const char *passport;
 
@@ -702,7 +699,6 @@
 
 	session = cmdproc->session;
 	account = session->account;
-	gc = account->gc;
 	swboard = cmdproc->data;
 
 	msn_switchboard_add_user(swboard, passport);
--- a/libpurple/protocols/msn/userlist.c	Fri Nov 05 00:38:46 2010 +0000
+++ b/libpurple/protocols/msn/userlist.c	Sat Nov 06 03:46:35 2010 +0000
@@ -699,8 +699,6 @@
 
 	if (userlist->buddy_icon_window > 0) {
 		GQueue *queue;
-		PurpleAccount *account;
-		const char *username;
 
 		queue = userlist->buddy_icon_requests;
 
@@ -709,9 +707,6 @@
 
 		user = g_queue_pop_head(queue);
 
-		account  = userlist->session->account;
-		username = user->passport;
-
 		userlist->buddy_icon_window--;
 
 		msn_request_user_display(user);