diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-22 20:08:08 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-22 20:08:08 +0800 |
commit | 555c78e00939cf1ce2a4f410e231b0271b654ed0 (patch) | |
tree | daad3a4dbd2a988fcfff6a7dac62cecb7ecd6971 /libempathy | |
parent | e6172665de111c2b32d6f16679add6f581c66a02 (diff) | |
download | gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar.gz gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar.bz2 gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar.lz gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar.xz gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.tar.zst gsoc2013-empathy-555c78e00939cf1ce2a4f410e231b0271b654ed0.zip |
account-settings: only remove the MC password param if set in the keyring OK
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-account-settings.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index c669753ae..a90aaa8f4 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -456,13 +456,40 @@ empathy_account_settings_get_password_cb (GObject *source, } static void +empathy_account_settings_migrate_password_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + TpAccount *account = TP_ACCOUNT (source); + GError *error = NULL; + EmpathyAccountSettings *self = user_data; + EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + GHashTable *empty; + const gchar *unset[] = { "password", NULL }; + + if (!empathy_keyring_set_password_finish (account, result, &error)) + { + DEBUG ("Failed to set password: %s", error->message); + g_clear_error (&error); + return; + } + + /* Now clear the password MC has stored. */ + empty = tp_asv_new (NULL, NULL); + tp_account_update_parameters_async (priv->account, + empty, unset, NULL, NULL); + + g_hash_table_remove (priv->parameters, "password"); + + g_hash_table_unref (empty); +} + +static void empathy_account_settings_try_migrating_password (EmpathyAccountSettings *self) { EmpathyAccountSettingsPriv *priv = GET_PRIV (self); const GValue *v; const gchar *password; - const gchar *unset[] = { "password", NULL }; - GHashTable *empty; if (!priv->supports_sasl || empathy_account_settings_get ( self, "password") == NULL) @@ -487,7 +514,7 @@ empathy_account_settings_try_migrating_password (EmpathyAccountSettings *self) return; empathy_keyring_set_password_async (priv->account, password, - NULL, NULL); + empathy_account_settings_migrate_password_cb, self); /* We don't want to request the password again, we * already know it. */ @@ -495,15 +522,6 @@ empathy_account_settings_try_migrating_password (EmpathyAccountSettings *self) priv->password = g_strdup (password); priv->password_original = g_strdup (password); - - /* Now clear the password MC has stored. */ - empty = tp_asv_new (NULL, NULL); - tp_account_update_parameters_async (priv->account, - empty, unset, NULL, NULL); - - g_hash_table_remove (priv->parameters, "password"); - - g_hash_table_unref (empty); } static void |