comparison src/blist.c @ 5580:86456ec3ca25

[gaim-migrate @ 5984] More nifty stuff! Accounts now get converted, and other niceties. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 31 May 2003 02:27:03 +0000
parents 9eb5b13fd412
children 5946be17f9ec
comparison
equal deleted inserted replaced
5579:e0146fcc4718 5580:86456ec3ca25
1560 1560
1561 return TRUE; 1561 return TRUE;
1562 } 1562 }
1563 1563
1564 void gaim_blist_load() { 1564 void gaim_blist_load() {
1565 GSList *accts; 1565 GList *accts;
1566 char *user_dir = gaim_user_dir(); 1566 char *user_dir = gaim_user_dir();
1567 char *filename; 1567 char *filename;
1568 char *msg; 1568 char *msg;
1569 1569
1570 blist_safe_to_write = TRUE; 1570 blist_safe_to_write = TRUE;
1579 msg = g_strdup_printf(_("An error was encountered parsing your " 1579 msg = g_strdup_printf(_("An error was encountered parsing your "
1580 "buddy list. It has not been loaded.")); 1580 "buddy list. It has not been loaded."));
1581 gaim_notify_error(NULL, NULL, _("Buddy List Error"), msg); 1581 gaim_notify_error(NULL, NULL, _("Buddy List Error"), msg);
1582 g_free(msg); 1582 g_free(msg);
1583 } 1583 }
1584 } else if(g_slist_length(gaim_accounts)) { 1584 } else if(g_list_length(gaim_accounts_get_all())) {
1585 /* rob wants to inform the user that their buddy lists are 1585 /* rob wants to inform the user that their buddy lists are
1586 * being converted */ 1586 * being converted */
1587 msg = g_strdup_printf(_("Gaim is converting your old buddy lists " 1587 msg = g_strdup_printf(_("Gaim is converting your old buddy lists "
1588 "to a new format, which will now be located at %s"), 1588 "to a new format, which will now be located at %s"),
1589 filename); 1589 filename);
1593 /* now, let gtk actually display the dialog before we start anything */ 1593 /* now, let gtk actually display the dialog before we start anything */
1594 while(gtk_events_pending()) 1594 while(gtk_events_pending())
1595 gtk_main_iteration(); 1595 gtk_main_iteration();
1596 1596
1597 /* read in the old lists, then save to the new format */ 1597 /* read in the old lists, then save to the new format */
1598 for(accts = gaim_accounts; accts; accts = accts->next) { 1598 for(accts = gaim_accounts_get_all(); accts; accts = accts->next) {
1599 do_import(accts->data, NULL); 1599 do_import(accts->data, NULL);
1600 } 1600 }
1601 gaim_blist_save(); 1601 gaim_blist_save();
1602 } 1602 }
1603 1603
1657 g_free(key_val); 1657 g_free(key_val);
1658 g_free(data_val); 1658 g_free(data_val);
1659 } 1659 }
1660 1660
1661 static void gaim_blist_write(FILE *file, GaimAccount *exp_acct) { 1661 static void gaim_blist_write(FILE *file, GaimAccount *exp_acct) {
1662 GSList *accounts, *buds; 1662 GList *accounts;
1663 GSList *buds;
1663 GaimBlistNode *gnode,*bnode; 1664 GaimBlistNode *gnode,*bnode;
1664 struct group *group; 1665 struct group *group;
1665 struct buddy *bud; 1666 struct buddy *bud;
1666 fprintf(file, "<?xml version='1.0' encoding='UTF-8' ?>\n"); 1667 fprintf(file, "<?xml version='1.0' encoding='UTF-8' ?>\n");
1667 fprintf(file, "<gaim version=\"1\">\n"); 1668 fprintf(file, "<gaim version=\"1\">\n");
1725 } 1726 }
1726 1727
1727 fprintf(file, "\t</blist>\n"); 1728 fprintf(file, "\t</blist>\n");
1728 fprintf(file, "\t<privacy>\n"); 1729 fprintf(file, "\t<privacy>\n");
1729 1730
1730 for(accounts = gaim_accounts; accounts; accounts = accounts->next) { 1731 for(accounts = gaim_accounts_get_all();
1732 accounts != NULL;
1733 accounts = accounts->next) {
1734
1731 GaimAccount *account = accounts->data; 1735 GaimAccount *account = accounts->data;
1732 char *acct_name = g_markup_escape_text(account->username, -1); 1736 char *acct_name = g_markup_escape_text(account->username, -1);
1733 if(!exp_acct || account == exp_acct) { 1737 if(!exp_acct || account == exp_acct) {
1734 fprintf(file, "\t\t<account protocol=\"%d\" name=\"%s\" " 1738 fprintf(file, "\t\t<account protocol=\"%d\" name=\"%s\" "
1735 "mode=\"%d\">\n", account->protocol, acct_name, account->perm_deny); 1739 "mode=\"%d\">\n", account->protocol, acct_name, account->perm_deny);