diff src/account.c @ 6367:9fd154ca6a94

[gaim-migrate @ 6872] The buddy removal code on account deletion has been moved to gaim_accounts_remove(). I think this is more correct, but still wonder about having an API function for actually deleting an account... This should do though. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 04 Aug 2003 19:35:17 +0000
parents 773b8ce563f5
children 41e6d15f4687
line wrap: on
line diff
--- a/src/account.c	Mon Aug 04 19:29:06 2003 +0000
+++ b/src/account.c	Mon Aug 04 19:35:17 2003 +0000
@@ -1260,11 +1260,35 @@
 void
 gaim_accounts_remove(GaimAccount *account)
 {
+	GaimBlistNode *gnode, *bnode;
+
 	g_return_if_fail(account != NULL);
 
 	accounts = g_list_remove(accounts, account);
 
 	schedule_accounts_save();
+
+	for (gnode = gaim_get_blist()->root; gnode != NULL; gnode = gnode->next) {
+		if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
+			continue;
+
+		for (bnode = gnode->child; bnode != NULL; bnode = bnode->next) {
+			if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
+				struct buddy *b = (struct buddy *)bnode;
+
+				if (b->account == account)
+					gaim_blist_remove_buddy(b);
+			}
+			else if (GAIM_BLIST_NODE_IS_CHAT(bnode)) {
+				struct chat *c = (struct chat *)bnode;
+
+				if (c->account == account)
+					gaim_blist_remove_chat(c);
+			}
+		}
+	}
+
+	gaim_blist_save();
 }
 
 void