changeset 23648:9bf36aad8735

We talked about this and decided it was probably cleaner to not use a static variable here.
author Mark Doliner <mark@kingant.net>
date Wed, 06 Aug 2008 09:27:06 +0000
parents bfbad8f78ec6
children 7b27180478ed
files libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/roster.c
diffstat 2 files changed, 34 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.h	Wed Aug 06 07:03:37 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Wed Aug 06 09:27:06 2008 +0000
@@ -108,6 +108,37 @@
 	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;
--- a/libpurple/protocols/jabber/roster.c	Wed Aug 06 07:03:37 2008 +0000
+++ b/libpurple/protocols/jabber/roster.c	Wed Aug 06 09:27:06 2008 +0000
@@ -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 @@
 	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 @@
 		}
 	}
 
-	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 @@
 	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)))