changeset 4938:461e8c89514f

[gaim-migrate @ 5272] don't let people delete buddies they don't even know are there ;-) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 01 Apr 2003 04:02:37 +0000
parents 4228bddbf2cd
children 4d50e125b0fa
files src/dialogs.c src/list.c
diffstat 2 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Tue Apr 01 03:27:50 2003 +0000
+++ b/src/dialogs.c	Tue Apr 01 04:02:37 2003 +0000
@@ -448,12 +448,13 @@
 	while (b) {
 		struct buddy *bd = (struct buddy *)b;
 		struct gaim_conversation *c = gaim_find_conversation(bd->name);
-		serv_remove_buddy(bd->account->gc, bd->name, g->name);
-		gaim_blist_remove_buddy(bd);
-
-		if (c != NULL)
-			gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
-
+		if(bd->account->gc) {
+			serv_remove_buddy(bd->account->gc, bd->name, g->name);
+			gaim_blist_remove_buddy(bd);
+
+			if (c != NULL)
+				gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
+		}
 		b = b->next;
 	}
 	gaim_blist_remove_group(g);
--- a/src/list.c	Tue Apr 01 03:27:50 2003 +0000
+++ b/src/list.c	Tue Apr 01 04:02:37 2003 +0000
@@ -342,14 +342,27 @@
 {
 	struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
 	GaimBlistNode *node = (GaimBlistNode*)group;
-	GaimBlistNode *child = node->child;
-	while (child) {
-		GaimBlistNode *n = child;
-		child = child->next;
-		gaim_blist_remove_buddy((struct buddy*)n);
+
+	if(node->child) {
+		char *buf;
+		int count = 0;
+		GaimBlistNode *child = node->child;
+
+		while(child) {
+			count++;
+			child = child->next;
+		}
+
+		buf = g_strdup_printf(_("%d buddies from group %s were not "
+					"removed because their accounts were not logged in.  These "
+					"buddies, and the group were not removed.\n"),
+				count, group->name);
+		do_error_dialog(_("Group Not Removed"), buf, GAIM_ERROR);
+		g_free(buf);
+		return;
 	}
 
-	if(node->parent->child == node)
+	if(node->parent && node->parent->child == node)
 		node->parent->child = node->next;
 	if (node->prev)
 		node->prev->next = node->next;