diff src/gtkblist.c @ 12112:875f59f9c0bb

[gaim-migrate @ 14412] A better interface for iterating the buddy list from none other than Sadrul committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 16 Nov 2005 08:27:17 +0000
parents 3b52d94437f3
children 46fcc0765187
line wrap: on
line diff
--- a/src/gtkblist.c	Wed Nov 16 06:07:42 2005 +0000
+++ b/src/gtkblist.c	Wed Nov 16 08:27:17 2005 +0000
@@ -3534,36 +3534,17 @@
 	gaim_signal_emit(handle, "gtkblist-created", list);
 }
 
-/* XXX: does this need fixing? */
 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
 {
-	GaimBlistNode *gnode, *cnode, *bnode;
-
-	for(gnode = list->root; gnode; gnode = gnode->next) {
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-		for(cnode = gnode->child; cnode; cnode = cnode->next) {
-			if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
-				if(remove)
-					gaim_gtk_blist_hide_node(list, cnode);
-
-				for(bnode = cnode->child; bnode; bnode = bnode->next) {
-					if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
-						continue;
-					if(remove)
-						gaim_gtk_blist_hide_node(list, bnode);
-					gaim_gtk_blist_update(list, bnode);
-				}
-
-				gaim_gtk_blist_update(list, cnode);
-			} else if(GAIM_BLIST_NODE_IS_CHAT(cnode)) {
-				if(remove)
-					gaim_gtk_blist_hide_node(list, cnode);
-
-				gaim_gtk_blist_update(list, cnode);
-			}
-		}
-		gaim_gtk_blist_update(list, gnode);
+	GaimBlistNode *node = list->root;
+
+	while (node)
+	{
+		if (!GAIM_BLIST_NODE_IS_GROUP(node) && remove)
+			gaim_gtk_blist_hide_node(list, node);
+
+		gaim_gtk_blist_update(list, node);
+		node = gaim_blist_node_next(node, FALSE);
 	}
 }