changeset 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 bee0e8ddfebc
children 0a1f7bff1ddd ea6e22fdc623 5b522d6e04ca
files libpurple/protocols/msn/notification.c libpurple/protocols/msn/session.h
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
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]);
--- a/libpurple/protocols/msn/session.h	Sat Mar 28 05:34:25 2009 +0000
+++ b/libpurple/protocols/msn/session.h	Sat Mar 28 07:31:29 2009 +0000
@@ -90,6 +90,7 @@
 
 	gboolean connected;
 	gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */
+	int      adl_fqy; /**< A count of ADL/FQY so status is only changed once. */
 	gboolean destroying; /**< A flag that states if the session is being destroyed. */
 	gboolean http_method;