changeset 23544:2d515f8f338e

A patch from felipec to stop requesting the MSN buddy icon when the object is changed in the middle of the request or the buddy has gone offline. References #5377. And http://pidgin.im/pipermail/devel/2008-June/006133.html And http://pidgin.im/pipermail/devel/2008-June/006134.html
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 22 Jun 2008 22:59:50 +0000
parents 80d09f42b157
children 1061a9ad1ddb 455a8264e06e
files libpurple/protocols/msn/slp.c
diffstat 1 files changed, 30 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Sun Jun 22 21:31:58 2008 +0000
+++ b/libpurple/protocols/msn/slp.c	Sun Jun 22 22:59:50 2008 +0000
@@ -1067,6 +1067,21 @@
 }
 
 static void
+next_buddy_request(MsnUserList *userlist)
+{
+	/* Free one window slot */
+	userlist->buddy_icon_window++;
+
+#ifdef MSN_DEBUG_UD
+	purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n",
+		userlist->buddy_icon_window);
+#endif
+
+	/* Request the next one */
+	msn_release_buddy_icon_request(userlist);
+}
+
+static void
 request_user_display(MsnUser *user)
 {
 	PurpleAccount *account;
@@ -1082,6 +1097,19 @@
 
 	obj = msn_user_get_object(user);
 
+	/* Changed while in the queue. */
+	if (obj == NULL) {
+		purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
+		next_buddy_request(session->userlist);
+		return;
+	}
+
+	/* The user went offline. */
+	if (user->status == NULL) {
+		next_buddy_request(session->userlist);
+		return;
+	}
+
 	info = msn_object_get_sha1(obj);
 
 	if (g_ascii_strcasecmp(user->passport,
@@ -1111,14 +1139,7 @@
 
 		purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info);
 
-		/* Free one window slot */
-		session->userlist->buddy_icon_window++;
-
-#ifdef MSN_DEBUG_UD
-		purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n",
-						session->userlist->buddy_icon_window);
-#endif
-
-		msn_release_buddy_icon_request(session->userlist);
+		next_buddy_request(session->userlist);
 	}
 }
+