]> git.0d.be Git - empathy.git/commitdiff
uoa-migration: delete account if plugin is missing
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 28 Aug 2012 08:19:00 +0000 (10:19 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 28 Aug 2012 08:38:17 +0000 (10:38 +0200)
Best to have to re-create an account than having a ghost account staying
around.

src/empathy-sanity-cleaning.c

index 9c9d83c2bd11617e312be1abc8518db7c97b86ad..326b6467139a45c27fd2a13e8eded0d5464f0249 100644 (file)
@@ -430,6 +430,24 @@ migrate_account_to_uoa (TpAccountManager *am,
   g_object_unref (ar);
 }
 
+static void
+uoa_account_remove_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  TpAccount *account = TP_ACCOUNT (source);
+  GError *error = NULL;
+
+  if (!tp_account_remove_finish (account, result, &error))
+    {
+      DEBUG ("Failed to remove account '%s': %s",
+          tp_account_get_path_suffix (account), error->message);
+      g_error_free (error);
+    }
+
+  g_object_set_data (G_OBJECT (account), DATA_SANITY_CTX, NULL);
+}
+
 static void
 uoa_plugin_install_cb (GObject *source,
     GAsyncResult *result,
@@ -441,10 +459,12 @@ uoa_plugin_install_cb (GObject *source,
 
   if (!empathy_pkg_kit_install_packages_finish (result, &error))
     {
-      DEBUG ("Failed to install plugin: %s", error->message);
+      DEBUG ("Failed to install plugin for account '%s' (%s); remove it",
+          tp_account_get_path_suffix (account), error->message);
+
       g_error_free (error);
 
-      g_object_set_data (G_OBJECT (account), DATA_SANITY_CTX, NULL);
+      tp_account_remove_async (account, uoa_account_remove_cb, NULL);
       goto out;
     }