telepathy-mission-control: McdAccountManager: ignore altered-one, deleted, toggled from wrong plugin
Simon McVittie
smcv at kemper.freedesktop.org
Thu Jan 30 04:34:41 PST 2014
Module: telepathy-mission-control
Branch: master
Commit: 5ec39a1c88cf74a1e81d65de66f084ff8d467e48
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=5ec39a1c88cf74a1e81d65de66f084ff8d467e48
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu Nov 14 18:01:33 2013 +0000
McdAccountManager: ignore altered-one, deleted, toggled from wrong plugin
Now that the account knows its own storage plugin, this is pretty easy.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
---
src/mcd-account-manager.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index cf9ce6b..54320c0 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -177,7 +177,7 @@ async_altered_one_manager_cb (McdManager *cm,
static void
-altered_one_cb (GObject *storage,
+altered_one_cb (McpAccountStorage *storage,
const gchar *account_name,
const gchar *key,
gpointer data)
@@ -187,6 +187,7 @@ altered_one_cb (GObject *storage,
McdAccount *account = NULL;
McdManager *cm = NULL;
const gchar *cm_name = NULL;
+ McpAccountStorage *its_plugin;
account = mcd_account_manager_lookup_account (am, account_name);
@@ -196,6 +197,18 @@ altered_one_cb (GObject *storage,
return;
}
+ its_plugin = mcd_account_get_storage_plugin (account);
+
+ if (storage != its_plugin)
+ {
+ DEBUG ("Ignoring altered-one from plugin %s because account %s "
+ "belongs to %s",
+ mcp_account_storage_name (storage),
+ account_name,
+ mcp_account_storage_name (its_plugin));
+ return;
+ }
+
/* in theory, the CM is already ready by this point, but make sure: */
cm_name = mcd_account_get_manager_name (account);
@@ -335,6 +348,7 @@ toggled_cb (GObject *plugin, const gchar *name, gboolean on, gpointer data)
McdAccountManager *manager = MCD_ACCOUNT_MANAGER (data);
McdAccount *account = NULL;
GError *error = NULL;
+ McpAccountStorage *its_plugin;
account = mcd_account_manager_lookup_account (manager, name);
@@ -348,6 +362,18 @@ toggled_cb (GObject *plugin, const gchar *name, gboolean on, gpointer data)
return;
}
+ its_plugin = mcd_account_get_storage_plugin (account);
+
+ if (storage_plugin != its_plugin)
+ {
+ DEBUG ("Ignoring toggled signal from plugin %s because account %s "
+ "belongs to %s",
+ mcp_account_storage_name (storage_plugin),
+ name,
+ mcp_account_storage_name (its_plugin));
+ return;
+ }
+
_mcd_account_set_enabled (account, on, FALSE,
MCD_DBUS_PROP_SET_FLAG_ALREADY_IN_STORAGE, &error);
@@ -422,6 +448,18 @@ deleted_cb (GObject *plugin, const gchar *name, gpointer data)
if (account != NULL)
{
const gchar * object_path = mcd_account_get_object_path (account);
+ McpAccountStorage *its_plugin = mcd_account_get_storage_plugin (
+ account);
+
+ if (storage_plugin != its_plugin)
+ {
+ DEBUG ("Ignoring altered-one from plugin %s because account %s "
+ "belongs to %s",
+ mcp_account_storage_name (storage_plugin),
+ name,
+ mcp_account_storage_name (its_plugin));
+ return;
+ }
g_object_ref (account);
/* this unhooks the account's signal handlers */
More information about the telepathy-commits
mailing list