# HG changeset patch # User Christian Hammond # Date 1060025717 0 # Node ID 9fd154ca6a94b7c4507b79e07904026db7aa22ce # Parent 773b8ce563f5673daedf0a8d5726a9c0c91eb7d5 [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 diff -r 773b8ce563f5 -r 9fd154ca6a94 src/account.c --- 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 diff -r 773b8ce563f5 -r 9fd154ca6a94 src/account.h --- a/src/account.h Mon Aug 04 19:29:06 2003 +0000 +++ b/src/account.h Mon Aug 04 19:35:17 2003 +0000 @@ -516,6 +516,9 @@ /** * Removes an account from the list of accounts. * + * This will remove any buddies from the buddy list that belong to this + * account. + * * @param account The account. */ void gaim_accounts_remove(GaimAccount *account);