changeset 6368:41e6d15f4687

[gaim-migrate @ 6873] Actually, I decided to move the code to delete an account into gaim_accounts_delete(). This way, gaim_accounts_{add,remove} can be used for simply manipulating the list... A function should really just do one thing right. gaim_accounts_delete() now handles the removal of an account from the list, the deletion of buddies, and the destroying of the account structure. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 04 Aug 2003 19:39:33 +0000
parents 9fd154ca6a94
children 1cdc8a11eea5
files src/account.c src/account.h src/gtkaccount.c
diffstat 3 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Mon Aug 04 19:35:17 2003 +0000
+++ b/src/account.c	Mon Aug 04 19:39:33 2003 +0000
@@ -1260,13 +1260,21 @@
 void
 gaim_accounts_remove(GaimAccount *account)
 {
-	GaimBlistNode *gnode, *bnode;
-
 	g_return_if_fail(account != NULL);
 
 	accounts = g_list_remove(accounts, account);
 
 	schedule_accounts_save();
+}
+
+void
+gaim_accounts_delete(GaimAccount *account)
+{
+	GaimBlistNode *gnode, *bnode;
+
+	g_return_if_fail(account != NULL);
+
+	gaim_accounts_remove(account);
 
 	for (gnode = gaim_get_blist()->root; gnode != NULL; gnode = gnode->next) {
 		if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
@@ -1289,6 +1297,8 @@
 	}
 
 	gaim_blist_save();
+
+	gaim_account_destroy(account);
 }
 
 void
--- a/src/account.h	Mon Aug 04 19:35:17 2003 +0000
+++ b/src/account.h	Mon Aug 04 19:39:33 2003 +0000
@@ -524,6 +524,16 @@
 void gaim_accounts_remove(GaimAccount *account);
 
 /**
+ * Deletes an account.
+ *
+ * This will remove any buddies from the buddy list that belong to this
+ * account, and will also destroy @a account.
+ *
+ * @param account The account.
+ */
+void gaim_accounts_delete(GaimAccount *account);
+
+/**
  * Auto-logins to all accounts set to auto-login under the specified UI.
  *
  * @param ui The UI.
--- a/src/gtkaccount.c	Mon Aug 04 19:35:17 2003 +0000
+++ b/src/gtkaccount.c	Mon Aug 04 19:39:33 2003 +0000
@@ -1470,8 +1470,7 @@
 		gtk_list_store_remove(accounts_window->model, &iter);
 	}
 
-	gaim_accounts_remove(account);
-	gaim_account_destroy(account);
+	gaim_accounts_delete(account);
 }
 
 static void