telepathy-mission-control: Butterfly account migration: migrate the password too, if stored

Simon McVittie smcv at kemper.freedesktop.org
Thu Sep 6 10:18:05 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 5e1bbe8f891af4d86cb9dfd2f0b36fdfbbb7b2ef
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=5e1bbe8f891af4d86cb9dfd2f0b36fdfbbb7b2ef

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Sep  6 16:40:37 2012 +0100

Butterfly account migration: migrate the password too, if stored

Otherwise the upgrade from Debian 6 to 7 forgets MSN passwords, which
is not the end of the world, but seems less nice than it could be.

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 src/mcd-account-manager.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index a13ba03..e4a81f7 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -1209,6 +1209,7 @@ migrate_butterfly_haze_ready (McdManager *manager,
     MigrateCtx *ctx = user_data;
     gchar *display_name;
     GValue v = {0,};
+    GValue password_v = {0,};
     GHashTable *parameters, *properties;
     gchar *str;
     GPtrArray *supersedes;
@@ -1221,7 +1222,7 @@ migrate_butterfly_haze_ready (McdManager *manager,
         goto error;
     }
 
-    /* Parameters; we just care about 'account' */
+    /* Parameters; the only mandatory one is 'account' */
     if (!mcd_account_get_parameter_of_known_type (ctx->account,
                                                   "account", G_TYPE_STRING,
                                                   &v, NULL))
@@ -1233,6 +1234,15 @@ migrate_butterfly_haze_ready (McdManager *manager,
     parameters = g_hash_table_new (g_str_hash, g_str_equal);
     g_hash_table_insert (parameters, "account", &v);
 
+    /* If MC is storing the password, let's copy that too, so Empathy
+     * can migrate it somewhere better. */
+    if (mcd_account_get_parameter_of_known_type (ctx->account,
+                                                 "password", G_TYPE_STRING,
+                                                 &password_v, NULL))
+    {
+        g_hash_table_insert (parameters, "password", &password_v);
+    }
+
     display_name = mcd_account_dup_display_name (ctx->account);
 
     /* Properties */



More information about the telepathy-commits mailing list