Mercurial > pidgin
comparison src/blist.c @ 5943:a4f2aba0848d
[gaim-migrate @ 6384]
This should fix corruption in the blist, accounts, and pounces when some
protocol plugins cannot load. Some parts of gaim now use the new unique
Plugin or Protocol Plugin IDs, while some still use the old protocol
numbers. Accounts kind of used both, and when prpls were missing, it had
trouble finding accounts. It would find the names, even without mapping the
protocol numbers to IDs, and any duplicate accounts would get nuked. That
would then affect pounce saving. Anyhow, long story short (well, it's
already long, too late for that), this should fix all that mess. And
introduce new mess, but hopefully temporary mess.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Mon, 23 Jun 2003 02:00:15 +0000 |
| parents | 390d32a6b130 |
| children | ac4dd1d0ee39 |
comparison
equal
deleted
inserted
replaced
| 5942:d0320de18feb | 5943:a4f2aba0848d |
|---|---|
| 1137 | 1137 |
| 1138 if (filename) { | 1138 if (filename) { |
| 1139 g_snprintf(path, sizeof(path), "%s", filename); | 1139 g_snprintf(path, sizeof(path), "%s", filename); |
| 1140 } else { | 1140 } else { |
| 1141 char *g_screenname = get_screenname_filename(account->username); | 1141 char *g_screenname = get_screenname_filename(account->username); |
| 1142 const char *username; | |
| 1142 char *file = gaim_user_dir(); | 1143 char *file = gaim_user_dir(); |
| 1143 int protocol = (account->protocol == GAIM_PROTO_OSCAR) ? (isalpha(account->username[0]) ? GAIM_PROTO_TOC : GAIM_PROTO_ICQ): account->protocol; | 1144 GaimProtocol prpl_num; |
| 1145 int protocol; | |
| 1146 | |
| 1147 prpl_num = gaim_account_get_protocol(account); | |
| 1148 | |
| 1149 protocol = prpl_num; | |
| 1150 | |
| 1151 if (prpl_num == GAIM_PROTO_OSCAR) { | |
| 1152 if ((username = gaim_account_get_username(account)) != NULL) { | |
| 1153 protocol = (isalpha(*username) | |
| 1154 ? GAIM_PROTO_TOC : GAIM_PROTO_ICQ); | |
| 1155 } | |
| 1156 } | |
| 1144 | 1157 |
| 1145 if (file != (char *)NULL) { | 1158 if (file != (char *)NULL) { |
| 1146 snprintf(path, PATHSIZE, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, protocol); | 1159 snprintf(path, PATHSIZE, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, protocol); |
| 1147 g_free(g_screenname); | 1160 g_free(g_screenname); |
| 1148 } else { | 1161 } else { |
| 1726 if(bud->alias) | 1739 if(bud->alias) |
| 1727 bud_alias= g_markup_escape_text(bud->alias, -1); | 1740 bud_alias= g_markup_escape_text(bud->alias, -1); |
| 1728 fprintf(file, "\t\t\t<person name=\"%s\">\n", | 1741 fprintf(file, "\t\t\t<person name=\"%s\">\n", |
| 1729 bud_alias ? bud_alias : bud_name); | 1742 bud_alias ? bud_alias : bud_name); |
| 1730 fprintf(file, "\t\t\t\t<buddy protocol=\"%d\" " | 1743 fprintf(file, "\t\t\t\t<buddy protocol=\"%d\" " |
| 1731 "account=\"%s\">\n", bud->account->protocol, | 1744 "account=\"%s\">\n", |
| 1745 gaim_account_get_protocol(bud->account), | |
| 1732 acct_name); | 1746 acct_name); |
| 1733 fprintf(file, "\t\t\t\t\t<name>%s</name>\n", bud_name); | 1747 fprintf(file, "\t\t\t\t\t<name>%s</name>\n", bud_name); |
| 1734 if(bud_alias) { | 1748 if(bud_alias) { |
| 1735 fprintf(file, "\t\t\t\t\t<alias>%s</alias>\n", | 1749 fprintf(file, "\t\t\t\t\t<alias>%s</alias>\n", |
| 1736 bud_alias); | 1750 bud_alias); |
| 1745 } | 1759 } |
| 1746 } else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) { | 1760 } else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) { |
| 1747 struct chat *chat = (struct chat *)bnode; | 1761 struct chat *chat = (struct chat *)bnode; |
| 1748 if(!exp_acct || chat->account == exp_acct) { | 1762 if(!exp_acct || chat->account == exp_acct) { |
| 1749 char *acct_name = g_markup_escape_text(chat->account->username, -1); | 1763 char *acct_name = g_markup_escape_text(chat->account->username, -1); |
| 1750 fprintf(file, "\t\t\t<chat protocol=\"%d\" account=\"%s\">\n", chat->account->protocol, acct_name); | 1764 fprintf(file, "\t\t\t<chat protocol=\"%d\" account=\"%s\">\n", |
| 1765 gaim_account_get_protocol(chat->account), | |
| 1766 acct_name); | |
| 1751 if(chat->alias) { | 1767 if(chat->alias) { |
| 1752 char *chat_alias = g_markup_escape_text(chat->alias, -1); | 1768 char *chat_alias = g_markup_escape_text(chat->alias, -1); |
| 1753 fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); | 1769 fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); |
| 1754 g_free(chat_alias); | 1770 g_free(chat_alias); |
| 1755 } | 1771 } |
| 1777 | 1793 |
| 1778 GaimAccount *account = accounts->data; | 1794 GaimAccount *account = accounts->data; |
| 1779 char *acct_name = g_markup_escape_text(account->username, -1); | 1795 char *acct_name = g_markup_escape_text(account->username, -1); |
| 1780 if(!exp_acct || account == exp_acct) { | 1796 if(!exp_acct || account == exp_acct) { |
| 1781 fprintf(file, "\t\t<account protocol=\"%d\" name=\"%s\" " | 1797 fprintf(file, "\t\t<account protocol=\"%d\" name=\"%s\" " |
| 1782 "mode=\"%d\">\n", account->protocol, acct_name, account->perm_deny); | 1798 "mode=\"%d\">\n", gaim_account_get_protocol(account), |
| 1799 acct_name, account->perm_deny); | |
| 1783 for(buds = account->permit; buds; buds = buds->next) { | 1800 for(buds = account->permit; buds; buds = buds->next) { |
| 1784 char *bud_name = g_markup_escape_text(buds->data, -1); | 1801 char *bud_name = g_markup_escape_text(buds->data, -1); |
| 1785 fprintf(file, "\t\t\t<permit>%s</permit>\n", bud_name); | 1802 fprintf(file, "\t\t\t<permit>%s</permit>\n", bud_name); |
| 1786 g_free(bud_name); | 1803 g_free(bud_name); |
| 1787 } | 1804 } |
