[Pkg-telepathy-commits] [telepathy-mission-control-6] 232/280: McdAccountManagerDefault: opportunistically save parameters' types

Simon McVittie smcv at debian.org
Thu Mar 27 20:07:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.

commit 08ade738693e685d7de271792f605ebbc8af03df
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Jan 28 16:30:07 2014 +0000

    McdAccountManagerDefault: opportunistically save parameters' types
---
 src/mcd-account-manager-default.c              | 23 ++++++-----------------
 tests/twisted/account-storage/load-keyfiles.py |  8 ++++----
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index b79b6bb..e9f2bf2 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -203,27 +203,16 @@ set_parameter (McpAccountStorage *self,
 
       old = g_hash_table_lookup (sa->parameters, parameter);
 
-      if (old == NULL)
-        {
-          /* it might still be in untyped_parameters? */
-          const gchar *escaped = g_hash_table_lookup (sa->untyped_parameters,
-              parameter);
-          gchar *new = mcp_account_manager_escape_variant_for_keyfile (
-              am, val);
-
-          if (!tp_strdiff (escaped, new))
-            {
-              g_free (new);
-              return MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED;
-            }
-
-          g_free (new);
-        }
-      else if (g_variant_equal (old, val))
+      if (old != NULL && g_variant_equal (old, val))
         {
           return MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED;
         }
 
+      /* We haven't checked whether it's in untyped_parameters with the
+       * same value - but if it is, we want to migrate it to parameters
+       * anyway (in order to record its type), so treat it as having
+       * actually changed. */
+
       g_hash_table_remove (sa->untyped_parameters, parameter);
       g_hash_table_insert (sa->parameters, g_strdup (parameter),
           g_variant_ref (val));
diff --git a/tests/twisted/account-storage/load-keyfiles.py b/tests/twisted/account-storage/load-keyfiles.py
index 35280db..1f4cd98 100644
--- a/tests/twisted/account-storage/load-keyfiles.py
+++ b/tests/twisted/account-storage/load-keyfiles.py
@@ -82,10 +82,10 @@ def test(q, bus, mc):
 'protocol': <'fakeprotocol'>,
 'DisplayName': <'Account in a low-priority location'>,
 'AutomaticPresence': <(uint32 2, 'available', '')>,
-'KeyFileParameters': <{
-    'account': 'dontdivertlow at example.com',
-    'password': 'password_in_variant_file',
-    'snakes': '42'
+'Parameters': <{
+    'account': <'dontdivertlow at example.com'>,
+    'password': <'password_in_variant_file'>,
+    'snakes': <uint32 42>
     }>
 }
 """)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git



More information about the Pkg-telepathy-commits mailing list