diff src/buddy.c @ 2334:b53cd5b63a99

[gaim-migrate @ 2347] i feel like everyone's watching me committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 21 Sep 2001 00:14:12 +0000
parents bd9d403fb15b
children 2927c2c26fe6
line wrap: on
line diff
--- a/src/buddy.c	Thu Sep 20 21:44:52 2001 +0000
+++ b/src/buddy.c	Fri Sep 21 00:14:12 2001 +0000
@@ -869,7 +869,6 @@
         delb = (struct buddy *)mem->data;
 	
         delg->members = g_slist_remove(delg->members, delb);
-        serv_remove_buddy(gc, delb->name);
 
 	gs = find_group_show(rem_g->name);
 	if (gs) {
@@ -907,9 +906,8 @@
 		update_buttons_by_protocol(c);
         g_free(delb);
 
-	/* flush buddy list to cache */
-
-	do_export(gc);
+	/* we don't flush buddy list to cache because in the case of remove_group that would
+	 * mean writing to the buddy list file once for each buddy, plus one more time */
 }
 
 void remove_group(struct gaim_connection *gc, struct group *rem_g)
@@ -917,6 +915,7 @@
 	GSList *grp;
 	GSList *mem;
 	struct group_show *gs;
+	GList *tmp = NULL;
 	
 	struct group *delg;
 	struct buddy *delb;
@@ -930,6 +929,7 @@
 
 	while(delg->members) {
 		delb = (struct buddy *)delg->members->data;
+		tmp = g_list_append(tmp, g_strdup(delb->name));
 		remove_buddy(gc, delg, delb); /* this should take care of removing
 						 the group_show if necessary */
 	}
@@ -944,9 +944,14 @@
 	}
 	g_free(delg);
 
-        /* flush buddy list to cache */
-
-        do_export(gc);
+	serv_remove_buddies(gc, tmp);
+	while (tmp) {
+		g_free(tmp->data);
+		tmp = g_list_remove(tmp, tmp->data);
+	}
+
+        /* don't flush buddy list to cache in order to be consistent with remove_buddy,
+	 * mostly. remove_group is only called from one place, so we'll let it handle it. */
 }
 
 
@@ -1386,6 +1391,7 @@
 			b = (struct buddy *)type;
 			g = find_group_by_buddy(b->gc, b->name);
 			gct = b->gc;
+			serv_remove_buddy(b->gc, b->name);
 			remove_buddy(b->gc, g, b);
 			gtk_ctree_remove_node(GTK_CTREE(edittree), node);
 			do_export(gct);