diff libpurple/protocols/msn/notification.c @ 26242:b0a91fc541e0

Save a count of how many ADL (per-request) and FQY (per-contact) we send, and then finish login only after they've all completed. Fixes #8588.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 28 Mar 2009 07:31:29 +0000
parents 399776a9ad98
children 0c077a605b8a
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Sat Mar 28 05:34:25 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat Mar 28 07:31:29 2009 +0000
@@ -630,7 +630,7 @@
 
 	} else {
 		purple_debug_error("msn",
-		                   "Got FQY update for unkwown user %s on network %d.\n",
+		                   "Got FQY update for unknown user %s on network %d.\n",
 		                   passport, network);
 	}
 }
@@ -686,6 +686,9 @@
 			if (++adl_count % 150 == 0) {
 				payload = xmlnode_to_str(adl_node, &payload_len);
 
+				/* ADL's are returned all-together */
+				session->adl_fqy++;
+
 				msn_notification_post_adl(session->notification->cmdproc,
 					payload, payload_len);
 
@@ -697,6 +700,9 @@
 				xmlnode_set_attrib(adl_node, "l", "1");
 			}
 		} else {
+			/* FQY's are returned one-at-a-time */
+			session->adl_fqy++;
+
 			msn_add_contact_xml(session, fqy_node, user->passport,
 				0, user->networkid);
 
@@ -718,6 +724,9 @@
 	if (adl_count == 0 || adl_count % 150 != 0) {
 		payload = xmlnode_to_str(adl_node, &payload_len);
 
+		/* ADL's are returned all-together */
+		session->adl_fqy++;
+
 		msn_notification_post_adl(session->notification->cmdproc, payload, payload_len);
 
 		g_free(payload);
@@ -804,7 +813,8 @@
 
 	if (!strcmp(cmd->params[1], "OK")) {
 		/* ADL ack */
-		msn_session_finish_login(session);
+		if (--session->adl_fqy == 0)
+			msn_session_finish_login(session);
 	} else {
 		cmdproc->last_cmd->payload_cb = adl_cmd_parse;
 		cmd->payload_len = atoi(cmd->params[1]);