pidgin.2.5.6: ff639e31: More MSN fixes to go along with f0df27a2...

qulogic at pidgin.im qulogic at pidgin.im
Sat May 2 19:15:41 EDT 2009


-----------------------------------------------------------------
Revision: ff639e31b359f9399c39cfaa0f02ca3c57686d7b
Ancestor: a4e91e84a8f8313c81aae1e3a4ec96f03953f28e
Author: qulogic at pidgin.im
Date: 2009-05-02T23:08:46
Branch: im.pidgin.pidgin.2.5.6
URL: http://d.pidgin.im/viewmtn/revision/info/ff639e31b359f9399c39cfaa0f02ca3c57686d7b

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

ChangeLog: 

More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:

Add an FQY error handler so we don't disconnect if something incorrect was
sent (unless the server kicked us itself).

Decrement the ADL/FQY count when we receive an error about a FQY for a user
so that we can continue to login even with bogus email addresses.

applied changes from 54f9b89abccda90d90bcd15d12fd091279a7f54e
             through a1d92d07631246e44303c044d75179ba68158e8b

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	758cb633aabbfe599da5ec637cb108b36a19c77f
+++ libpurple/protocols/msn/notification.c	b1f079bab30468bbc7e2bb5e3f308834cced2b6f
@@ -612,8 +612,19 @@ update_contact_network(MsnSession *sessi
 static void
 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network)
 {
-	MsnUser *user = msn_userlist_find_user(session->userlist, passport);
+	MsnUser *user;
+
+	if (network == MSN_NETWORK_UNKNOWN)
+	{
+		purple_debug_warning("msn",
+		                     "Ignoring user %s about which server knows nothing.\n",
+		                     passport);
+		session->adl_fqy--;
+		return;
+	}
+
 	/* TODO: Also figure out how to update membership lists */
+	user = msn_userlist_find_user(session->userlist, passport);
 	if (user) {
 		xmlnode *adl_node;
 		char *payload;
@@ -774,13 +785,17 @@ adl_cmd_parse(MsnCmdProc *cmdproc, MsnCo
 		purple_debug_info("msn", "Invalid XML in ADL!\n");
 		return;
 	}
-	for (domain_node = xmlnode_get_child(root, "d"); domain_node; domain_node = xmlnode_get_next_twin(domain_node)) {
+	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)) {
+		for (contact_node = xmlnode_get_child(domain_node, "c");
+		     contact_node;
+		     contact_node = xmlnode_get_next_twin(contact_node)) {
 			const gchar *list;
 			gint list_op = 0;
 
@@ -942,10 +957,10 @@ fqy_cmd_post(MsnCmdProc *cmdproc, MsnCom
 
 			passport = g_strdup_printf("%s@%s", local, domain);
 
-			if (type != NULL)
+			if (!g_ascii_isdigit(cmd->command[0]) && type != NULL)
 				network = (MsnNetwork)strtoul(type, NULL, 10);
 			else
-				network = MSN_NETWORK_PASSPORT;
+				network = MSN_NETWORK_UNKNOWN;
 
 			purple_debug_info("msn", "FQY response says %s is from network %d\n",
 			                  passport, network);
@@ -960,6 +975,26 @@ static void
 }
 
 static void
+fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
+{
+	MsnCommand *cmd = cmdproc->last_cmd;
+
+	purple_debug_warning("msn", "FQY error %d\n", error);
+	if (cmd->param_count > 1) {
+		cmd->payload_cb = fqy_cmd_post;
+		cmd->payload_len = atoi(cmd->params[1]);
+		cmd->payload_cbdata = GINT_TO_POINTER(error);
+	}
+#if 0
+	/* If the server didn't send us a corresponding email address for this
+	   FQY error, it's probably going to disconnect us. So it isn't necessary
+	   to tell the handler about it. */
+	else if (trans->data)
+		((MsnFqyCb)trans->data)(session, NULL, MSN_NETWORK_UNKNOWN); */
+#endif
+}
+
+static void
 fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	purple_debug_info("msn", "Process FQY\n");
@@ -2153,6 +2188,7 @@ msn_notification_init(void)
 
 	msn_table_add_error(cbs_table, "ADD", add_error);
 	msn_table_add_error(cbs_table, "ADL", adl_error);
+	msn_table_add_error(cbs_table, "FQY", fqy_error);
 	msn_table_add_error(cbs_table, "REG", reg_error);
 	msn_table_add_error(cbs_table, "RMG", rmg_error);
 	msn_table_add_error(cbs_table, "USR", usr_error);


More information about the Commits mailing list