summaryrefslogtreecommitdiff
path: root/libpurple/account.c
diff options
context:
space:
mode:
authorJohn Bailey <rekkanoryo@rekkanoryo.org>2009-07-06 06:04:34 +0000
committerJohn Bailey <rekkanoryo@rekkanoryo.org>2009-07-06 06:04:34 +0000
commitb5f3b5119af2ac77f956387242165824b8dc34ba (patch)
treec188d5b73a1ac5b19bb6c071564de3fd52132332 /libpurple/account.c
parent1abae99552936a7fb4053fc749dcb987ce66756b (diff)
parentec870cbeadeafe3b29d4d202759e0b8504ad4d6f (diff)
downloadpidgin-b5f3b5119af2ac77f956387242165824b8dc34ba.tar.gz
propagate from branch 'im.pidgin.cpw.rekkanoryo.yahoo.separate_prpls' (head 1c99d31c85e20c70f330ebe29a548b3036b5cd7e)
to branch 'im.pidgin.pidgin' (head 8d75ebb8ba36d541f5e3f3234798b5b09028d41a)
Diffstat (limited to 'libpurple/account.c')
-rw-r--r--libpurple/account.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/libpurple/account.c b/libpurple/account.c
index 4cef080565..8d6a404cf9 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -481,6 +481,36 @@ schedule_accounts_save(void)
/*********************************************************************
* Reading from disk *
*********************************************************************/
+static void
+migrate_yahoo_japan(PurpleAccount *account)
+{
+ /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it
+ * to use the new prpl-yahoojp. Also remove the account-specific settings
+ * we no longer need */
+
+ if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) {
+ if(purple_account_get_bool(account, "yahoojp", FALSE)) {
+ const char *serverjp = purple_account_get_string(account, "serverjp", NULL);
+ const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL);
+
+ g_return_if_fail(serverjp != NULL);
+ g_return_if_fail(xferjp_host != NULL);
+
+ purple_account_set_string(account, "server", serverjp);
+ purple_account_set_string(account, "xfer_host", xferjp_host);
+
+ purple_account_set_protocol_id(account, "prpl-yahoojp");
+ }
+
+ /* these should always be nuked */
+ purple_account_remove_setting(account, "yahoojp");
+ purple_account_remove_setting(account, "serverjp");
+ purple_account_remove_setting(account, "xferjp_host");
+
+ }
+
+ return;
+}
static void
parse_settings(xmlnode *node, PurpleAccount *account)
@@ -545,6 +575,10 @@ parse_settings(xmlnode *node, PurpleAccount *account)
g_free(data);
}
+
+ /* we do this here because we need access to account settings to determine
+ * if we can/should migrate an old Yahoo! JAPAN account */
+ migrate_yahoo_japan(account);
}
static GList *
@@ -1728,6 +1762,15 @@ purple_account_clear_settings(PurpleAccount *account)
}
void
+purple_account_remove_setting(PurpleAccount *account, const char *setting)
+{
+ g_return_if_fail(account != NULL);
+ g_return_if_fail(setting != NULL);
+
+ g_hash_table_remove(account->settings, setting);
+}
+
+void
purple_account_set_int(PurpleAccount *account, const char *name, int value)
{
PurpleAccountSetting *setting;