| 448 |
447 |
| 449 schedule_accounts_save(); |
448 schedule_accounts_save(); |
| 450 } |
449 } |
| 451 |
450 |
| 452 void |
451 void |
| 453 gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol) |
|
| 454 { |
|
| 455 g_return_if_fail(account != NULL); |
|
| 456 |
|
| 457 gaim_account_set_protocol_id(account, gaim_prpl_num_to_id(protocol)); |
|
| 458 } |
|
| 459 |
|
| 460 void |
|
| 461 gaim_account_set_protocol_id(GaimAccount *account, const char *protocol_id) |
452 gaim_account_set_protocol_id(GaimAccount *account, const char *protocol_id) |
| 462 { |
453 { |
| 463 g_return_if_fail(account != NULL); |
454 g_return_if_fail(account != NULL); |
| 464 g_return_if_fail(protocol_id != NULL); |
455 g_return_if_fail(protocol_id != NULL); |
| 465 |
456 |
| 724 gaim_account_get_buddy_icon(const GaimAccount *account) |
715 gaim_account_get_buddy_icon(const GaimAccount *account) |
| 725 { |
716 { |
| 726 g_return_val_if_fail(account != NULL, NULL); |
717 g_return_val_if_fail(account != NULL, NULL); |
| 727 |
718 |
| 728 return account->buddy_icon; |
719 return account->buddy_icon; |
| 729 } |
|
| 730 |
|
| 731 GaimProtocol |
|
| 732 gaim_account_get_protocol(const GaimAccount *account) |
|
| 733 { |
|
| 734 g_return_val_if_fail(account != NULL, -1); |
|
| 735 |
|
| 736 return gaim_prpl_id_to_num(gaim_account_get_protocol_id(account)); |
|
| 737 } |
720 } |
| 738 |
721 |
| 739 const char * |
722 const char * |
| 740 gaim_account_get_protocol_id(const GaimAccount *account) |
723 gaim_account_get_protocol_id(const GaimAccount *account) |
| 741 { |
724 { |
| 1555 who = g_strdup(gaim_normalize(NULL, name)); |
1538 who = g_strdup(gaim_normalize(NULL, name)); |
| 1556 |
1539 |
| 1557 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
1540 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
| 1558 account = (GaimAccount *)l->data; |
1541 account = (GaimAccount *)l->data; |
| 1559 |
1542 |
| 1560 if (!strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) { |
|
| 1561 if (protocol != -1) { |
|
| 1562 if (gaim_account_get_protocol(account) == protocol) |
|
| 1563 break; |
|
| 1564 } |
|
| 1565 else |
|
| 1566 break; |
|
| 1567 } |
|
| 1568 |
|
| 1569 account = NULL; |
|
| 1570 } |
|
| 1571 |
|
| 1572 g_free(who); |
|
| 1573 |
|
| 1574 return account; |
|
| 1575 } |
|
| 1576 |
|
| 1577 GaimAccount * |
|
| 1578 gaim_accounts_find(const char *name, const char *protocol_id) |
|
| 1579 { |
|
| 1580 GaimAccount *account = NULL; |
|
| 1581 GList *l; |
|
| 1582 char *who; |
|
| 1583 |
|
| 1584 g_return_val_if_fail(name != NULL, NULL); |
|
| 1585 |
|
| 1586 who = g_strdup(gaim_normalize(NULL, name)); |
|
| 1587 |
|
| 1588 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
|
| 1589 account = (GaimAccount *)l->data; |
|
| 1590 |
|
| 1591 if (!strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who) && |
1543 if (!strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who) && |
| 1592 (!protocol_id || !strcmp(account->protocol_id, protocol_id))) { |
1544 (!protocol_id || !strcmp(account->protocol_id, protocol_id))) { |
| 1593 |
1545 |
| 1594 break; |
1546 break; |
| 1595 } |
1547 } |
| 1596 |
1548 |
| 1597 account = NULL; |
1549 account = NULL; |
| 1598 } |
1550 } |
| 1599 |
|
| 1600 if(!account && protocol_id) |
|
| 1601 account = gaim_accounts_find_with_prpl_num(name, atoi(protocol_id)); |
|
| 1602 |
1551 |
| 1603 g_free(who); |
1552 g_free(who); |
| 1604 |
1553 |
| 1605 return account; |
1554 return account; |
| 1606 } |
1555 } |