pidgin: 072d62ee: jabber: Remove the roster pool stuff.

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Oct 25 23:01:04 EDT 2009


-----------------------------------------------------------------
Revision: 072d62ee37a9f2bed803c6af8e0ec96d19189d7b
Ancestor: b3bd619705d16cc5a946ed1be4f2a9ee6d05d19e
Author: darkrain42 at pidgin.im
Date: 2009-10-26T02:58:28
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/072d62ee37a9f2bed803c6af8e0ec96d19189d7b

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

ChangeLog: 

jabber: Remove the roster pool stuff.

The purpose of this seems to be to re-use buddies (move a buddy from one
group to another instead of delete/create).  purple_blist_add_buddy ends
up calling serv_move_buddy (to move the buddy server-side), but this wasn't
actually a problem due to js->currently_parsing_roster_push being set
(which wasn't obvious at all).

Anyway, long story short, both deryni and I think this is probably more
effort than it's worth.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/roster.c	648e029bc757f394c00a8cf3a31315f8b302c3f2
+++ libpurple/protocols/jabber/roster.c	d92234368a5e19b64ed543ee74d5f766653068ab
@@ -72,7 +72,7 @@ static void add_purple_buddy_to_groups(J
 		const char *alias, GSList *groups)
 {
 	GSList *buddies, *l;
-	GSList *pool = NULL;
+	PurpleAccount *account = purple_connection_get_account(js->gc);
 
 	buddies = purple_find_buddies(js->gc->account, jid);
 
@@ -117,25 +117,14 @@ static void add_purple_buddy_to_groups(J
 			groups = g_slist_delete_link(groups, l);
 		} else {
 			/* This buddy isn't in the group on the server anymore */
-			pool = g_slist_prepend(pool, b);
+			purple_debug_info("jabber", "jabber_roster_parse(): Removing %s "
+			                  "from group '%s' on the local list\n",
+			                  purple_buddy_get_name(b),
+			                  purple_group_get_name(g));
+			purple_blist_remove_buddy(b);
 		}
 	}
 
-	if (pool) {
-		GString *tmp = g_string_new(NULL);
-		GSList *list = pool;
-		for ( ; list; list = list->next) {
-			tmp = g_string_append(tmp,
-					purple_group_get_name(purple_buddy_get_group(list->data)));
-			if (list->next)
-				tmp = g_string_append(tmp, ", ");
-		}
-
-		purple_debug_info("jabber", "jabber_roster_parse(): Removing %s from "
-		                  "groups: %s\n", jid, tmp->str);
-		g_string_free(tmp, TRUE);
-	}
-
 	if (groups) {
 		char *tmp = roster_groups_join(groups);
 		purple_debug_info("jabber", "jabber_roster_parse(): Adding %s to "
@@ -145,18 +134,8 @@ static void add_purple_buddy_to_groups(J
 
 	while(groups) {
 		PurpleGroup *g = purple_find_group(groups->data);
-		PurpleBuddy *b = NULL;
+		PurpleBuddy *b = purple_buddy_new(account, jid, alias);
 
-		/* If there are buddies we would otherwise delete, move them to
-		 * the new group (instead of deleting them below)
-		 */
-		if (pool) {
-			b = pool->data;
-			pool = g_slist_delete_link(pool, pool);
-		} else {
-			b = purple_buddy_new(js->gc->account, jid, alias);
-		}
-
 		if(!g) {
 			g = purple_group_new(groups->data);
 			purple_blist_add_group(g, NULL);
@@ -169,14 +148,6 @@ static void add_purple_buddy_to_groups(J
 		groups = g_slist_delete_link(groups, groups);
 	}
 
-	/* Remove this person from all the groups they're no longer in on the
-	 * server */
-	while (pool) {
-		PurpleBuddy *b = pool->data;
-		purple_blist_remove_buddy(b);
-		pool = g_slist_delete_link(pool, pool);
-	}
-
 	g_slist_free(buddies);
 }
 


More information about the Commits mailing list