pidgin: abe03ceb: We talked about this and decided it was ...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Aug 6 05:30:43 EDT 2008


-----------------------------------------------------------------
Revision: abe03ceb78ba869447172f1b7db863c9de727713
Ancestor: 35825186162ceeeb74274d49847ea7d0cee8c464
Author: markdoliner at pidgin.im
Date: 2008-08-06T09:27:06
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/abe03ceb78ba869447172f1b7db863c9de727713

Modified files:
        libpurple/protocols/jabber/jabber.h
        libpurple/protocols/jabber/roster.c

ChangeLog: 

We talked about this and decided it was probably cleaner to not use
a static variable here.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.h	5db2ebb103d8d20a03087bd9cf27aab964a68bb3
+++ libpurple/protocols/jabber/jabber.h	88ac28243798c76a2cc7fa2f08051e77869d0167
@@ -108,6 +108,37 @@ struct _JabberStream
 	GHashTable *buddies;
 	gboolean roster_parsed;
 
+	/*
+	 * This boolean was added to eliminate a heinous bug where we would
+	 * get into a loop with the server and move a buddy back and forth
+	 * from one group to another.
+	 *
+	 * The sequence goes something like this:
+	 * 1. Our resource and another resource both approve an authorization
+	 *    request at the exact same time.  We put the buddy in group A and
+	 *    the other resource put the buddy in group B.
+	 * 2. The server receives the roster add for group B and sends us a
+	 *    roster push.
+	 * 3. We receive this roster push and modify our local blist.  This
+	 *    triggers us to send a roster add for group B.
+	 * 4. The server recieves our earlier roster add for group A and sends
+	 *    us a roster push.
+	 * 5. We receive this roster push and modify our local blist.  This
+	 *    triggers us to send a roster add for group A.
+	 * 6. The server receives our earlier roster add for group B and sends
+	 *    us a roster push.
+	 * (repeat steps 3 through 6 ad infinitum)
+	 *
+	 * This boolean is used to short-circuit the sending of a roster add
+	 * when we receive a roster push.
+	 *
+	 * See these bug reports:
+	 * http://trac.adiumx.com/ticket/8834
+	 * http://developer.pidgin.im/ticket/5484
+	 * http://developer.pidgin.im/ticket/6188
+	 */
+	gboolean currently_parsing_roster_push;
+
 	GHashTable *chats;
 	GList *chat_servers;
 	PurpleRoomlist *roomlist;
============================================================
--- libpurple/protocols/jabber/roster.c	61f8bdd309bca21ee4af24799b36260832d75659
+++ libpurple/protocols/jabber/roster.c	d36e9b2dff53ec21cc32ae8ea19ffa1a9d18f858
@@ -31,37 +31,6 @@
 
 #include <string.h>
 
-/*
- * This boolean was added to eliminate a heinous bug where we would
- * get into a loop with the server and move a buddy back and forth
- * from one group to another.
- *
- * The sequence goes something like this:
- * 1. Our resource and another resource both approve an authorization
- *    request at the exact same time.  We put the buddy in group A and
- *    the other resource put the buddy in group B.
- * 2. The server receives the roster add for group B and sends us a
- *    roster push.
- * 3. We receive this roster push and modify our local blist.  This
- *    triggers us to send a roster add for group B.
- * 4. The server recieves our earlier roster add for group A and sends
- *    us a roster push.
- * 5. We receive this roster push and modify our local blist.  This
- *    triggers us to send a roster add for group A.
- * 6. The server receives our earlier roster add for group B and sends
- *    us a roster push.
- * (repeat steps 3 through 6 ad infinitum)
- *
- * This boolean is used to short-circuit the sending of a roster add
- * when we receive a roster push.
- *
- * See these bug reports:
- * http://trac.adiumx.com/ticket/8834
- * http://developer.pidgin.im/ticket/5484
- * http://developer.pidgin.im/ticket/6188
- */
-static gboolean parsing_from_server = FALSE;
-
 void jabber_roster_request(JabberStream *js)
 {
 	JabberIq *iq;
@@ -199,7 +168,7 @@ void jabber_roster_parse(JabberStream *j
 	if(!query)
 		return;
 
-	parsing_from_server = TRUE;
+	js->currently_parsing_roster_push = TRUE;
 
 	for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item))
 	{
@@ -283,7 +252,7 @@ void jabber_roster_parse(JabberStream *j
 		}
 	}
 
-	parsing_from_server = FALSE;
+	js->currently_parsing_roster_push = FALSE;
 
 	/* if we're just now parsing the roster for the first time,
 	 * then now would be the time to send our initial presence */
@@ -303,7 +272,7 @@ static void jabber_roster_update(JabberS
 	JabberIq *iq;
 	xmlnode *query, *item, *group;
 
-	if (parsing_from_server)
+	if (js->currently_parsing_roster_push)
 		return;
 
 	if(!(b = purple_find_buddy(js->gc->account, name)))


More information about the Commits mailing list