Mercurial > pidgin.yaz
comparison src/account.c @ 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 | 412c5a0f9ef1 |
children | d048e5f2af27 |
comparison
equal
deleted
inserted
replaced
5866:d6b5cab288bb | 5867:db4df0be06fd |
---|---|
124 | 124 |
125 GaimAccount * | 125 GaimAccount * |
126 gaim_account_new(const char *username, GaimProtocol protocol) | 126 gaim_account_new(const char *username, GaimProtocol protocol) |
127 { | 127 { |
128 GaimAccount *account; | 128 GaimAccount *account; |
129 GList *l; | |
129 | 130 |
130 g_return_val_if_fail(username != NULL, NULL); | 131 g_return_val_if_fail(username != NULL, NULL); |
132 | |
133 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { | |
134 account = l->data; | |
135 | |
136 if (!strcmp(gaim_account_get_username(account), username) && | |
137 gaim_account_get_protocol(account) == protocol) { | |
138 | |
139 return account; | |
140 } | |
141 } | |
131 | 142 |
132 account = g_new0(GaimAccount, 1); | 143 account = g_new0(GaimAccount, 1); |
133 | 144 |
134 gaim_account_set_username(account, username); | 145 gaim_account_set_username(account, username); |
135 gaim_account_set_protocol(account, protocol); | 146 gaim_account_set_protocol(account, protocol); |
1190 void | 1201 void |
1191 gaim_accounts_add(GaimAccount *account) | 1202 gaim_accounts_add(GaimAccount *account) |
1192 { | 1203 { |
1193 g_return_if_fail(account != NULL); | 1204 g_return_if_fail(account != NULL); |
1194 | 1205 |
1206 if (g_list_find(accounts, account) != NULL) | |
1207 return; | |
1208 | |
1195 accounts = g_list_append(accounts, account); | 1209 accounts = g_list_append(accounts, account); |
1196 | 1210 |
1197 schedule_accounts_save(); | 1211 schedule_accounts_save(); |
1198 } | 1212 } |
1199 | 1213 |