changeset 5867:db4df0be06fd

[gaim-migrate @ 6298] Added a little bit of code to prevent duplicate accounts, but it doesn't fix the problem of importing all new accounts when are importing from the old .gaimrc and also have an accounts.xml already established. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 14 Jun 2003 12:01:19 +0000
parents d6b5cab288bb
children d048e5f2af27
files src/account.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sat Jun 14 11:55:15 2003 +0000
+++ b/src/account.c	Sat Jun 14 12:01:19 2003 +0000
@@ -126,9 +126,20 @@
 gaim_account_new(const char *username, GaimProtocol protocol)
 {
 	GaimAccount *account;
+	GList *l;
 
 	g_return_val_if_fail(username != NULL, NULL);
 
+	for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
+		account = l->data;
+
+		if (!strcmp(gaim_account_get_username(account), username) &&
+			gaim_account_get_protocol(account) == protocol) {
+
+			return account;
+		}
+	}
+
 	account = g_new0(GaimAccount, 1);
 
 	gaim_account_set_username(account, username);
@@ -1192,6 +1203,9 @@
 {
 	g_return_if_fail(account != NULL);
 
+	if (g_list_find(accounts, account) != NULL)
+		return;
+
 	accounts = g_list_append(accounts, account);
 
 	schedule_accounts_save();