[PATCH 3/4] Skip request when the object is changed in the middle of the request.

Felipe Contreras felipe.contreras at gmail.com
Sun Jun 22 11:03:20 EDT 2008


---
 libpurple/protocols/msn/slp.c |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c
index e029b40..fe863be 100644
--- a/libpurple/protocols/msn/slp.c
+++ b/libpurple/protocols/msn/slp.c
@@ -1066,6 +1066,21 @@ end_user_display(MsnSlpCall *slpcall, MsnSession *session)
 														  msn_release_buddy_icon_request_timeout, userlist);
 }
 
+static inline void
+skip_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)
 {
@@ -1082,6 +1097,14 @@ request_user_display(MsnUser *user)
 
 	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);
+		skip_request(session->userlist);
+		return;
+	}
+
 	info = msn_object_get_sha1(obj);
 
 	if (g_ascii_strcasecmp(user->passport,
@@ -1111,14 +1134,6 @@ request_user_display(MsnUser *user)
 
 		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);
+		skip_request(session->userlist);
 	}
 }
-- 
1.5.6




More information about the Devel mailing list