diff src/account.c @ 5580:86456ec3ca25

[gaim-migrate @ 5984] More nifty stuff! Accounts now get converted, and other niceties. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 31 May 2003 02:27:03 +0000
parents a95e872e58dc
children 3a9b54f260e3
line wrap: on
line diff
--- a/src/account.c	Sat May 31 02:20:09 2003 +0000
+++ b/src/account.c	Sat May 31 02:27:03 2003 +0000
@@ -36,6 +36,7 @@
 
 typedef enum
 {
+	TAG_NONE = 0,
 	TAG_PROTOCOL,
 	TAG_NAME,
 	TAG_PASSWORD,
@@ -585,6 +586,8 @@
 		data->setting_name = NULL;
 	}
 
+	data->tag = TAG_NONE;
+
 	g_free(buffer);
 }
 
@@ -793,6 +796,37 @@
 	g_free(filename_real);
 }
 
+void
+gaim_accounts_reorder(GaimAccount *account, size_t new_index)
+{
+	size_t index;
+	GList *l;
+
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(new_index > 0 && new_index < g_list_length(accounts));
+
+	index = g_list_index(accounts, account);
+
+	if (index == -1) {
+		gaim_debug(GAIM_DEBUG_ERROR, "accounts",
+				   "Unregistered account (%s) discovered during reorder!\n",
+				   gaim_account_get_username(account));
+		return;
+	}
+
+	l = g_list_nth(accounts, index);
+
+	if (new_index > index)
+		new_index--;
+
+	/* Remove the old one. */
+	accounts = g_list_delete_link(accounts, l);
+
+	/* Insert it where it should go. */
+	accounts = g_list_insert(accounts, account, new_index);
+
+	schedule_accounts_save();
+}
 
 GList *
 gaim_accounts_get_all(void)