pidgin: 0841af13: Check network type, and send an FQY if n...

qulogic at pidgin.im qulogic at pidgin.im
Sun Jun 7 04:10:47 EDT 2009


-----------------------------------------------------------------
Revision: 0841af13da028245cc279ce8f927ff05c0367ae1
Ancestor: 6d3a0b29b22baeedf393b76044dde689caef3b45
Author: qulogic at pidgin.im
Date: 2009-06-07T07:51:50
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0841af13da028245cc279ce8f927ff05c0367ae1

Modified files:
        ChangeLog libpurple/protocols/msn/notification.c

ChangeLog: 

Check network type, and send an FQY if necessary, when modifying the allow
and block lists. Before, users who were not added by you (i.e. spammers)
would have no network type and cause disconnects. This should fix it.

Fixes #8977.

-------------- next part --------------
============================================================
--- ChangeLog	b511596934d59bc12e32e0c31a9279526857322c
+++ ChangeLog	71539f08c8d248e1d601b004e756cc2c8e4d2f41
@@ -20,6 +20,9 @@ version 2.6.0 (??/??/2009):
 	  moved to a new network and the old servers are not accessible.
 	* Gadu-Gadu accounts can specify a server to which to connect.
 	  (Krzysztof "kreez" Tobola)
+	* Modifying the MSN privacy list for buddies not added by you (i.e.
+	  spammers and other generally unwanted users) should no longer cause
+	  a 240 error and disconnection.
 
 	XMPP:
 	* Voice & Video support with Jingle (XEP-0166, 0167, 0176, & 0177), voice
============================================================
--- libpurple/protocols/msn/notification.c	8f5d430cd7c59d9978c56a4fa406441ee0d19e86
+++ libpurple/protocols/msn/notification.c	a49541843d251a2f4ed4e9837c3d39c6444e645b
@@ -1973,10 +1973,54 @@ system_msg(MsnCmdProc *cmdproc, MsnMessa
 	g_hash_table_destroy(table);
 }
 
+/**************************************************************************
+ * Dispatch server list management 
+ **************************************************************************/
+typedef struct MsnAddRemoveListData {
+	MsnCmdProc *cmdproc;
+	MsnUser *user;
+	MsnListOp list_op;
+	gboolean add;
+} MsnAddRemoveListData;
+
+static void
+modify_unknown_buddy_on_list(MsnSession *session, const char *passport,
+                             MsnNetwork network, gpointer data)
+{
+	MsnAddRemoveListData *addrem = data;
+	MsnCmdProc *cmdproc;
+	xmlnode *node;
+	char *payload;
+	int payload_len;
+
+	cmdproc = addrem->cmdproc;
+
+	/* Update user first */
+	msn_user_set_network(addrem->user, network);
+
+	node = xmlnode_new("ml");
+	node->child = NULL;
+
+	msn_add_contact_xml(session, node, passport,
+	                    addrem->list_op, network);
+
+	payload = xmlnode_to_str(node, &payload_len);
+	xmlnode_free(node);
+
+	if (addrem->add)
+		msn_notification_post_adl(cmdproc, payload, payload_len);
+	else
+		msn_notification_post_rml(cmdproc, payload, payload_len);
+
+	g_free(payload);
+	g_free(addrem);
+}
+
 void
 msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id,
 							  MsnUser *user)
 {
+	MsnAddRemoveListData *addrem;
 	MsnCmdProc *cmdproc;
 	MsnListOp list_op = 1 << list_id;
 	xmlnode *adl_node;
@@ -1994,7 +2038,20 @@ msn_notification_add_buddy_to_list(MsnNo
 	payload = xmlnode_to_str(adl_node, &payload_len);
 	xmlnode_free(adl_node);
 
-	msn_notification_post_adl(cmdproc, payload, payload_len);
+	if (user->networkid != MSN_NETWORK_UNKNOWN) {
+		msn_notification_post_adl(cmdproc, payload, payload_len);
+
+	} else {
+		addrem = g_new(MsnAddRemoveListData, 1);
+		addrem->cmdproc = cmdproc;
+		addrem->user = user;
+		addrem->list_op = list_op;
+		addrem->add = TRUE;
+
+		msn_notification_send_fqy(notification->session, payload, payload_len,
+		                          modify_unknown_buddy_on_list, addrem);
+	}
+
 	g_free(payload);
 }
 
@@ -2002,6 +2059,7 @@ msn_notification_rem_buddy_from_list(Msn
 msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id,
 						   MsnUser *user)
 {
+	MsnAddRemoveListData *addrem;
 	MsnCmdProc *cmdproc;
 	MsnListOp list_op = 1 << list_id;
 	xmlnode *rml_node;
@@ -2019,8 +2077,20 @@ msn_notification_rem_buddy_from_list(Msn
 	payload = xmlnode_to_str(rml_node, &payload_len);
 	xmlnode_free(rml_node);
 
-	msn_notification_post_rml(cmdproc, payload, payload_len);
+	if (user->networkid != MSN_NETWORK_UNKNOWN) {
+		msn_notification_post_rml(cmdproc, payload, payload_len);
 
+	} else {
+		addrem = g_new(MsnAddRemoveListData, 1);
+		addrem->cmdproc = cmdproc;
+		addrem->user = user;
+		addrem->list_op = list_op;
+		addrem->add = FALSE;
+
+		msn_notification_send_fqy(notification->session, payload, payload_len,
+		                          modify_unknown_buddy_on_list, addrem);
+	}
+
 	g_free(payload);
 }
 


More information about the Commits mailing list