changeset 1049:749e25dc90cb

[gaim-migrate @ 1059] removing buddies when appropriate, and a bad fix for a bug committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 01 Nov 2000 23:44:30 +0000
parents 49799527aebf
children c4baa5509558
files src/buddy.c src/dialogs.c
diffstat 2 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Wed Nov 01 22:34:00 2000 +0000
+++ b/src/buddy.c	Wed Nov 01 23:44:30 2000 +0000
@@ -169,6 +169,49 @@
 #endif
 
 
+static void destroy_buddies(struct gaim_connection *gc) {
+	GSList *s = shows;
+	struct group_show *g;
+	GSList *m;
+	struct buddy_show *b;
+
+	while (s) {
+		gboolean remove_group = FALSE;
+		g = (struct group_show *)s->data;
+		m = g->members;
+		while (m) {
+			b = (struct buddy_show *)m->data;
+			if (g_slist_length(b->connlist) == 1 && b->connlist->data == gc) {
+				if (b->log_timer > 0)
+					gtk_timeout_remove(b->log_timer);
+				b->connlist = g_slist_remove(b->connlist, gc);
+				gtk_widget_destroy(b->item);
+				g->members = g_slist_remove(g->members, b);
+				if (g->members == NULL) {
+					shows = g_slist_remove(shows, g);
+					gtk_widget_destroy(g->item);
+					g_free(g->name);
+					g_free(g);
+					m = NULL;
+					remove_group = TRUE;
+				} else
+					m = g->members;
+				g_free(b->name);
+				g_free(b->show);
+				g_free(b);
+			} else {
+				b->connlist = g_slist_remove(b->connlist, gc);
+				m = g_slist_next(m);
+			}
+		}
+		if (remove_group)
+			s = shows;
+		else
+			s = g_slist_next(s);
+	}
+}
+
+
 void signoff_all(GtkWidget *w, gpointer d)
 {
 	GSList *c = connections;
@@ -183,6 +226,7 @@
 
 void signoff(struct gaim_connection *gc)
 {
+	destroy_buddies(gc);
 	plugin_event(event_signoff, gc, 0, 0, 0);
 	serv_close(gc);
 
@@ -1264,6 +1308,10 @@
 	while (c) {
 		g = (struct gaim_connection *)c->data;
 		p = find_group(g, group);
+		if (!p) {
+			c = c->next;
+			continue;
+		}
 		z = p->members;
 		while (z) {
 			b = (struct buddy *)z->data;
--- a/src/dialogs.c	Wed Nov 01 22:34:00 2000 +0000
+++ b/src/dialogs.c	Wed Nov 01 23:44:30 2000 +0000
@@ -2789,6 +2789,8 @@
 			g_free (first);
 			return;
 		}
+		/* FIXME */
+		gc = connections->data;
         }
         else {
 		for (i = 0; i < strlen(gc->username); i++)