comparison src/account.c @ 7132:d17a587efeb3

[gaim-migrate @ 7699] new blist parser code, and some tweaks to the account code to make my next commit possible. the other parser code can get moved over to this model to make things cleaner, but i'm too lazy to do it now. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 03 Oct 2003 21:49:11 +0000
parents bf630f7dfdcd
children e6b01bd8d6cd
comparison
equal deleted inserted replaced
7131:af889fd531d0 7132:d17a587efeb3
126 GaimAccount *account = NULL; 126 GaimAccount *account = NULL;
127 127
128 g_return_val_if_fail(username != NULL, NULL); 128 g_return_val_if_fail(username != NULL, NULL);
129 129
130 if(protocol_id) 130 if(protocol_id)
131 account = gaim_accounts_find_with_prpl_id(username, protocol_id); 131 account = gaim_accounts_find(username, protocol_id);
132 132
133 if (account != NULL) 133 if (account != NULL)
134 return account; 134 return account;
135 135
136 account = g_new0(GaimAccount, 1); 136 account = g_new0(GaimAccount, 1);
1515 gaim_accounts_get_all(void) 1515 gaim_accounts_get_all(void)
1516 { 1516 {
1517 return accounts; 1517 return accounts;
1518 } 1518 }
1519 1519
1520 GaimAccount * 1520 static GaimAccount *
1521 gaim_accounts_find(const char *name, GaimProtocol protocol) 1521 gaim_accounts_find_with_prpl_num(const char *name, GaimProtocol protocol)
1522 { 1522 {
1523 GaimAccount *account = NULL; 1523 GaimAccount *account = NULL;
1524 GList *l; 1524 GList *l;
1525 char *who; 1525 char *who;
1526 1526
1547 1547
1548 return account; 1548 return account;
1549 } 1549 }
1550 1550
1551 GaimAccount * 1551 GaimAccount *
1552 gaim_accounts_find_with_prpl_id(const char *name, const char *protocol_id) 1552 gaim_accounts_find(const char *name, const char *protocol_id)
1553 { 1553 {
1554 GaimAccount *account = NULL; 1554 GaimAccount *account = NULL;
1555 GList *l; 1555 GList *l;
1556 char *who; 1556 char *who;
1557 1557
1561 1561
1562 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { 1562 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
1563 account = (GaimAccount *)l->data; 1563 account = (GaimAccount *)l->data;
1564 1564
1565 if (!strcmp(gaim_normalize(gaim_account_get_username(account)), who) && 1565 if (!strcmp(gaim_normalize(gaim_account_get_username(account)), who) &&
1566 !strcmp(account->protocol_id, protocol_id)) { 1566 (!protocol_id || !strcmp(account->protocol_id, protocol_id))) {
1567 1567
1568 break; 1568 break;
1569 } 1569 }
1570 1570
1571 account = NULL; 1571 account = NULL;
1572 } 1572 }
1573
1574 if(!account && protocol_id)
1575 account = gaim_accounts_find_with_prpl_num(name, atoi(protocol_id));
1573 1576
1574 g_free(who); 1577 g_free(who);
1575 1578
1576 return account; 1579 return account;
1577 } 1580 }