g_signal_emit (self, signals[PASSWORD_RETRIEVED], 0);
}
+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)
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. */
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