libpurple/account.c

branch
cpw.rekkanoryo.yahoo.separate_prpls
changeset 27562
2e34a10e7135
parent 27497
2dc5a0e0c4c2
child 27563
3f38f3d8b8ba
equal deleted inserted replaced
27561:86add5f08943 27562:2e34a10e7135
479 479
480 480
481 /********************************************************************* 481 /*********************************************************************
482 * Reading from disk * 482 * Reading from disk *
483 *********************************************************************/ 483 *********************************************************************/
484 static void
485 migrate_yahoo_japan(PurpleAccount *account)
486 {
487 /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it
488 * to use the new prpl-yahoojp. Also remove the account-specific settings
489 * we no longer need */
490
491 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) {
492 if(purple_account_get_bool(account, "yahoojp", FALSE)) {
493 const char *serverjp = purple_account_get_string(account, "serverjp", NULL);
494 const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL);
495
496 g_return_if_fail(serverjp != NULL);
497 g_return_if_fail(xferjp_host != NULL);
498
499 purple_account_set_string(account, "server", serverjp);
500 purple_account_set_string(account, "xfer_host", xferjp_host);
501
502 purple_account_set_protocol_id(account, "prpl-yahoojp");
503 }
504
505 /* these should always be nuked */
506 purple_account_remove_setting(account, "serverjp");
507 purple_account_remove_setting(account, "xferjp_host");
508
509 }
510
511 return;
512 }
484 513
485 static void 514 static void
486 parse_settings(xmlnode *node, PurpleAccount *account) 515 parse_settings(xmlnode *node, PurpleAccount *account)
487 { 516 {
488 const char *ui; 517 const char *ui;
543 (*data == '0' ? FALSE : TRUE)); 572 (*data == '0' ? FALSE : TRUE));
544 } 573 }
545 574
546 g_free(data); 575 g_free(data);
547 } 576 }
577
578 /* we do this here because we need access to account settings to determine
579 * if we can/should migrate an old Yahoo! JAPAN account */
580 migrate_yahoo_japan(account);
548 } 581 }
549 582
550 static GList * 583 static GList *
551 parse_status_attrs(xmlnode *node, PurpleStatus *status) 584 parse_status_attrs(xmlnode *node, PurpleStatus *status)
552 { 585 {
1723 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, 1756 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
1724 g_free, delete_setting); 1757 g_free, delete_setting);
1725 } 1758 }
1726 1759
1727 void 1760 void
1761 purple_account_remove_setting(PurpleAccount *account, const char *setting)
1762 {
1763 g_return_if_fail(account != NULL);
1764 g_return_if_fail(setting != NULL);
1765
1766 g_hash_table_remove(account->settings, setting);
1767 }
1768
1769 void
1728 purple_account_set_int(PurpleAccount *account, const char *name, int value) 1770 purple_account_set_int(PurpleAccount *account, const char *name, int value)
1729 { 1771 {
1730 PurpleAccountSetting *setting; 1772 PurpleAccountSetting *setting;
1731 1773
1732 g_return_if_fail(account != NULL); 1774 g_return_if_fail(account != NULL);

mercurial