[Pkg-telepathy-commits] [telepathy-mission-control-6] 107/280: Merge remote-tracking branch 'origin/master' into next

Simon McVittie smcv at debian.org
Thu Mar 27 20:07:11 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 d20882f50c32b5b759ab4b25332f6cf096a40061
Merge: af35f4c a64073a
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Nov 5 13:23:49 2013 +0000

    Merge remote-tracking branch 'origin/master' into next
    
    Conflicts:
    	configure.ac
    	src/mcd-account-manager.c
    	src/mcd-dispatcher.c
    	src/mcd-storage.c
    	tests/twisted/account-storage/default-keyring-storage.py
    	tests/twisted/dispatcher/dispatch-obsolete.py

 NEWS                                               |  41 +
 configure.ac                                       |  33 +-
 mission-control-plugins/account-storage.c          |  13 +-
 mission-control-plugins/account-storage.h          |   4 +-
 mission-control-plugins/account.c                  |  52 +-
 mission-control-plugins/account.h                  |  13 +-
 mission-control-plugins/implementation.h           |  13 +-
 src/Makefile.am                                    |   7 +-
 src/connectivity-monitor.c                         |  63 +-
 src/dispatcher.xml                                 |   7 -
 src/mcd-account-manager-default.c                  | 849 ++++++++++++++++++---
 src/mcd-account-manager-default.h                  |   6 +-
 src/mcd-account-manager-sso.c                      |   6 +-
 src/mcd-account-manager.c                          | 133 ++--
 src/mcd-dispatcher.c                               |  16 +-
 src/mcd-storage.c                                  | 491 ++++++++----
 src/mcd-storage.h                                  |  11 +-
 src/mcd.xml                                        |   2 -
 tests/Makefile.am                                  |   7 +-
 ...unt-store-default.c => account-store-keyfile.c} |  14 +-
 ...unt-store-default.h => account-store-keyfile.h} |  16 +-
 tests/account-store-variant-file.c                 | 189 +++++
 ...tore-default.h => account-store-variant-file.h} |  20 +-
 tests/account-store.c                              |  28 +-
 tests/twisted/account-manager/account-basics.py    |   2 +-
 tests/twisted/account-manager/auto-connect.py      |   9 +-
 tests/twisted/account-manager/avatar-refresh.py    |   8 +-
 tests/twisted/account-manager/avatar.py            |   8 +-
 tests/twisted/account-manager/connectivity.py      |   2 +-
 tests/twisted/account-manager/crashy-cm.py         |   4 +-
 .../twisted/account-manager/create-auto-connect.py |   2 +-
 tests/twisted/account-manager/create-twice.py      |   5 +-
 .../account-manager/create-with-properties.py      |  10 +-
 tests/twisted/account-manager/device-idle.py       |   2 +-
 .../twisted/account-manager/enable-auto-connect.py |   2 +-
 tests/twisted/account-manager/enable.py            |   2 +-
 tests/twisted/account-manager/irc.py               |   2 +-
 tests/twisted/account-manager/make-valid.py        |   7 +-
 tests/twisted/account-manager/nickname.py          |   2 +-
 tests/twisted/account-manager/param-types.py       |   8 +-
 tests/twisted/account-manager/presence.py          |   2 +-
 tests/twisted/account-manager/reconnect.py         |   5 +-
 .../account-manager/recover-from-disconnect.py     |   2 +-
 tests/twisted/account-manager/req-conn-fails.py    |   2 +-
 tests/twisted/account-manager/request-online.py    |   5 +-
 tests/twisted/account-manager/server-drops-us.py   |   5 +-
 tests/twisted/account-manager/service.py           |   2 +-
 tests/twisted/account-manager/update-parameters.py |   5 +-
 tests/twisted/account-requests/cancel.py           |   2 +-
 tests/twisted/account-requests/create-text.py      |   2 +-
 .../delete-account-during-request.py               |   2 +-
 .../account-storage/default-keyring-storage.py     | 187 +++--
 tests/twisted/account-storage/diverted-storage.py  |   6 +-
 tests/twisted/account/addressing.py                |   2 +-
 tests/twisted/capabilities/contact-caps.py         |   2 +-
 tests/twisted/crash-recovery/crash-recovery.py     |   2 +-
 tests/twisted/dbus-account-plugin.c                |   4 +-
 tests/twisted/dispatcher/already-has-channel.py    |   2 +-
 tests/twisted/dispatcher/approver-fails.py         |   2 +-
 tests/twisted/dispatcher/bypass-approval.py        |   2 +-
 tests/twisted/dispatcher/bypass-observers.py       |   2 +-
 tests/twisted/dispatcher/cancel.py                 |   2 +-
 tests/twisted/dispatcher/capture-bundle.py         |   2 +-
 tests/twisted/dispatcher/cdo-claim.py              |   2 +-
 tests/twisted/dispatcher/connect-for-request.py    |   2 +-
 tests/twisted/dispatcher/create-at-startup.py      |   5 +-
 .../dispatcher/create-delayed-by-mini-plugin.py    |   2 +-
 tests/twisted/dispatcher/create-handler-fails.py   |   2 +-
 tests/twisted/dispatcher/create-hints.py           |   2 +-
 .../dispatcher/create-no-preferred-handler.py      |   2 +-
 .../dispatcher/create-rejected-by-mini-plugin.py   |   2 +-
 tests/twisted/dispatcher/create-text.py            |   2 +-
 .../twisted/dispatcher/created-behind-our-back.py  |   2 +-
 tests/twisted/dispatcher/delay-approvers.py        |   2 +-
 .../dispatcher/delay-then-call-handle-with.py      |   2 +-
 .../dispatcher/delay-then-dont-call-approvers.py   |   2 +-
 tests/twisted/dispatcher/dispatch-activatable.py   |   2 +-
 .../dispatcher/dispatch-before-connected.py        |   2 +-
 .../dispatcher/dispatch-delayed-by-mini-plugin.py  |   2 +-
 .../dispatcher/dispatch-rejected-by-mini-plugin.py |   2 +-
 tests/twisted/dispatcher/dispatch-text.py          |   2 +-
 tests/twisted/dispatcher/ensure-and-redispatch.py  |   2 +-
 tests/twisted/dispatcher/ensure-is-approval.py     |   2 +-
 tests/twisted/dispatcher/ensure-rapidly.py         |   2 +-
 tests/twisted/dispatcher/exploding-bundles.py      |   2 +-
 tests/twisted/dispatcher/fdo-21034.py              |   2 +-
 tests/twisted/dispatcher/handle-channels-fails.py  |   2 +-
 tests/twisted/dispatcher/lose-text.py              |   2 +-
 .../twisted/dispatcher/recover-from-disconnect.py  |   5 +-
 tests/twisted/dispatcher/redispatch-channels.py    |   2 +-
 .../twisted/dispatcher/request-disabled-account.py |   2 +-
 .../dispatcher/respawn-activatable-observers.py    |   2 +-
 tests/twisted/dispatcher/respawn-observers.py      |   2 +-
 tests/twisted/dispatcher/some-delay-approvers.py   |   2 +-
 tests/twisted/dispatcher/undispatchable.py         |   2 +-
 tests/twisted/dispatcher/vanishing-client.py       |   2 +-
 tests/twisted/mctest.py                            | 172 ++++-
 ...Channel_Dispatcher_Interface_Messages_DRAFT.xml |  57 --
 xml/Makefile.am                                    |   2 +-
 99 files changed, 1967 insertions(+), 694 deletions(-)

diff --cc configure.ac
index e9c823c,ad90d58..726c754
--- a/configure.ac
+++ b/configure.ac
@@@ -211,16 -211,16 +211,16 @@@ PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.95
  AC_SUBST(DBUS_CFLAGS)
  AC_SUBST(DBUS_LIBS)
  
 -PKG_CHECK_MODULES([TELEPATHY], [telepathy-glib >= 0.23.0])
 -AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_0_24],
 -  [Ignore post-0.24 deprecations])
 -AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_0_24],
 -  [Prevent post-0.24 APIs])
 +PKG_CHECK_MODULES([TELEPATHY],
 +  [telepathy-glib-1 >= 0.99.2.1, telepathy-glib-1-dbus >= 0.99.2.1])
 +AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_1_0],
 +  [Ignore post-1.0 deprecations])
 +AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_1_0],
 +  [Prevent post-1.0 APIs])
  AC_DEFINE([TP_SEAL_ENABLE], [], [Define to hide deprecated struct fields])
 -AC_DEFINE([TP_DISABLE_SINGLE_INCLUDE], [], [Avoid individual headers])
  
  PKG_CHECK_MODULES([GLIB],
- 	[glib-2.0 >= 2.32, gobject-2.0, gmodule-no-export-2.0, gio-2.0])
+ 	[glib-2.0 >= 2.36, gobject-2.0, gmodule-no-export-2.0, gio-2.0])
  
  PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0],
    [
diff --cc src/mcd-account-manager-default.c
index 4e9c7ca,202e8c4..4d4efda
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@@ -65,12 -123,32 +123,32 @@@ get_old_filename (void
  }
  
  static gchar *
- account_filename_in (const gchar *dir)
+ accounts_cfg_in (const gchar *dir)
  {
 -  return g_build_filename (dir, "telepathy", "mission-control", "accounts.cfg",
 -      NULL);
 +  return g_build_filename (dir, "telepathy-1", "mission-control",
 +      "accounts.cfg", NULL);
  }
  
+ static gchar *
+ account_directory_in (const gchar *dir)
+ {
 -  return g_build_filename (dir, "telepathy", "mission-control", NULL);
++  return g_build_filename (dir, "telepathy-1", "mission-control", NULL);
+ }
+ 
+ static gchar *
+ account_file_in (const gchar *dir,
+     const gchar *account)
+ {
+   gchar *basename = g_strdup_printf ("%s.account", account);
+   gchar *ret;
+ 
+   g_strdelimit (basename, "/", '-');
 -  ret = g_build_filename (dir, "telepathy", "mission-control",
++  ret = g_build_filename (dir, "telepathy-1", "mission-control",
+       basename, NULL);
+   g_free (basename);
+   return ret;
+ }
+ 
  static void
  mcd_account_manager_default_init (McdAccountManagerDefault *self)
  {
diff --cc src/mcd-account-manager.c
index 7d9cdbc,cd10461..2675dd9
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@@ -817,12 -813,12 +818,12 @@@ identify_account_cb (GObject *source_ob
          return;
      }
  
-     provider = tp_asv_get_string (properties,
+     provider = tp_asv_get_string (cad->properties,
 -                                  TP_PROP_ACCOUNT_INTERFACE_STORAGE_STORAGE_PROVIDER);
 +        TP_PROP_ACCOUNT_INTERFACE_STORAGE1_STORAGE_PROVIDER);
  
      unique_name = mcd_storage_create_account (storage, provider,
-                                               manager, protocol, params,
-                                               &e);
+                                               cad->cm_name, cad->protocol_name,
+                                               id, &cad->error);
  
      if (unique_name == NULL)
      {
diff --cc src/mcd-dispatcher.c
index 814c406,3184446..bf310c2
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@@ -84,10 -77,10 +77,10 @@@ static void messages_iface_init (gpoint
  G_DEFINE_TYPE_WITH_CODE (McdDispatcher, mcd_dispatcher, G_TYPE_OBJECT,
      G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_DISPATCHER,
                             dispatcher_iface_init);
-     G_IMPLEMENT_INTERFACE (MC_TYPE_SVC_CHANNEL_DISPATCHER_INTERFACE_MESSAGES_DRAFT,
+     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_DISPATCHER_INTERFACE_MESSAGES1,
                             messages_iface_init);
      G_IMPLEMENT_INTERFACE (
 -        TP_TYPE_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST,
 +        TP_TYPE_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST1,
          NULL);
      G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
                             tp_dbus_properties_mixin_iface_init))
@@@ -356,7 -349,8 +349,8 @@@ _mcd_dispatcher_set_property (GObject 
  }
  
  static const char * const interfaces[] = {
 -    TP_IFACE_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST,
 +    TP_IFACE_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST1,
+     TP_IFACE_CHANNEL_DISPATCHER_INTERFACE_MESSAGES1,
      NULL
  };
  
diff --cc src/mcd-storage.c
index 566359a,323a287..c4f11ed
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@@ -1064,6 -1124,121 +1124,121 @@@ mcd_keyfile_get_value (GKeyFile *keyfil
    switch (type)
      {
        case G_TYPE_STRING:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_STRING, error);
+         break;
+ 
+       case G_TYPE_INT:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_INT32, error);
+         break;
+ 
+       case G_TYPE_INT64:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_INT64, error);
+         break;
+ 
+       case G_TYPE_UINT:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_UINT32, error);
+         break;
+ 
+       case G_TYPE_UCHAR:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_BYTE, error);
+         break;
+ 
+       case G_TYPE_UINT64:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_UINT64, error);
+         break;
+ 
+       case G_TYPE_BOOLEAN:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_BOOLEAN, error);
+         break;
+ 
+       case G_TYPE_DOUBLE:
+         variant = mcd_keyfile_get_variant (keyfile, group, key,
+             G_VARIANT_TYPE_DOUBLE, error);
+         break;
+ 
+       default:
+         if (type == G_TYPE_STRV)
+           {
+             variant = mcd_keyfile_get_variant (keyfile, group, key,
+                 G_VARIANT_TYPE_STRING_ARRAY, error);
+           }
+         else if (type == DBUS_TYPE_G_OBJECT_PATH)
+           {
+             variant = mcd_keyfile_get_variant (keyfile, group, key,
+                 G_VARIANT_TYPE_OBJECT_PATH, error);
+           }
+         else if (type == TP_ARRAY_TYPE_OBJECT_PATH_LIST)
+           {
+             variant = mcd_keyfile_get_variant (keyfile, group, key,
+                 G_VARIANT_TYPE_OBJECT_PATH_ARRAY, error);
+           }
 -        else if (type == TP_STRUCT_TYPE_SIMPLE_PRESENCE)
++        else if (type == TP_STRUCT_TYPE_PRESENCE)
+           {
+             variant = mcd_keyfile_get_variant (keyfile, group, key,
+                 G_VARIANT_TYPE ("(uss)"), error);
+           }
+         else
+           {
+             gchar *message =
+               g_strdup_printf ("cannot get key %s from group %s: "
+                   "unknown type %s",
+                   key, group, g_type_name (type));
+ 
+             g_warning ("%s: %s", G_STRFUNC, message);
+             g_set_error (error, MCD_ACCOUNT_ERROR,
+                 MCD_ACCOUNT_ERROR_GET_PARAMETER,
+                 "%s", message);
+             g_free (message);
+           }
+     }
+ 
+   if (variant == NULL)
+     return FALSE;
+ 
+   g_variant_ref_sink (variant);
+   g_value_unset (value);
+   dbus_g_value_parse_g_variant (variant, value);
+   g_assert (G_VALUE_TYPE (value) == type);
+   g_variant_unref (variant);
+   return TRUE;
+ }
+ 
+ /*
+  * mcd_keyfile_get_variant:
+  * @keyfile: A #GKeyFile
+  * @group: name of a group
+  * @key: name of a key
+  * @type: the desired type
+  * @error: a place to store any #GError<!-- -->s that occur
+  *
+  * Returns: a new floating #GVariant
+  */
+ GVariant *
+ mcd_keyfile_get_variant (GKeyFile *keyfile,
+     const gchar *group,
+     const gchar *key,
+     const GVariantType *type,
+     GError **error)
+ {
+   const gchar *type_str = g_variant_type_peek_string (type);
+   GVariant *ret = NULL;
+ 
+   g_return_val_if_fail (keyfile != NULL, NULL);
+   g_return_val_if_fail (group != NULL, NULL);
+   g_return_val_if_fail (key != NULL, NULL);
+   g_return_val_if_fail (g_variant_type_string_scan (type_str, NULL, NULL),
+       NULL);
+ 
+   switch (type_str[0])
+     {
+       case G_VARIANT_CLASS_STRING:
            {
              gchar *v_string = g_key_file_get_string (keyfile, group,
                  key, error);
diff --cc tests/account-store-variant-file.c
index 0000000,b3fc756..bea6827
mode 000000,100644..100644
--- a/tests/account-store-variant-file.c
+++ b/tests/account-store-variant-file.c
@@@ -1,0 -1,189 +1,189 @@@
+ /*
+  * MC account storage inspector: MC 5.14 GVariant-file backend
+  *
+  * Copyright © 2010 Nokia Corporation
+  * Copyright © 2010-2013 Collabora Ltd.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+  * License as published by the Free Software Foundation; either
+  * version 2.1 of the License, or (at your option) any later version.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this library; if not, write to the Free Software
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+  */
+ 
+ #include "config.h"
+ #include "account-store-variant-file.h"
+ 
+ #include <errno.h>
+ 
+ #include <glib.h>
+ #include <glib/gstdio.h>
+ 
+ static gchar *
+ get_path (const gchar *account)
+ {
+   gchar *ret;
+   gchar *basename;
+ 
+   basename = g_strdup_printf ("%s.account", account);
+   g_strdelimit (basename, "/", '-');
+ 
 -  ret = g_build_filename (g_get_user_data_dir (), "telepathy",
++  ret = g_build_filename (g_get_user_data_dir (), "telepathy-1",
+       "mission-control", basename, NULL);
+   g_free (basename);
+   return ret;
+ }
+ 
+ static GVariant *
+ load (const gchar *account)
+ {
+   GError *error = NULL;
+   gchar *contents = NULL;
+   gsize len;
+   GVariant *ret = NULL;
+   gchar *path = NULL;
+ 
+   path = get_path (account);
+ 
+   if (!g_file_get_contents (path, &contents, &len, &error))
+     goto finally;
+ 
+   ret = g_variant_parse (G_VARIANT_TYPE_VARDICT, contents, contents + len,
+         NULL, &error);
+ 
+ finally:
+   if (error != NULL)
+       g_warning ("variant file '%s' error: %s", path, error->message);
+ 
+   g_free (path);
+   g_clear_error (&error);
+   g_free (contents);
+   return ret;
+ }
+ 
+ gchar *
+ variant_get (const gchar *account,
+     const gchar *key)
+ {
+   GVariant *asv = load (account);
+   GVariant *v = NULL;
+   GString *ret = NULL;
+ 
+   if (asv == NULL)
+     return NULL;
+ 
+   if (g_str_has_prefix (key, "param-"))
+     {
+       GVariant *intermediate = g_variant_lookup_value (asv,
+           "Parameters", NULL);
+ 
+       if (intermediate != NULL)
+         {
+           g_assert (g_variant_is_of_type (intermediate,
+                 G_VARIANT_TYPE ("a{sv}")));
+           v = g_variant_lookup_value (intermediate, key + 6, NULL);
+         }
+ 
+       intermediate = g_variant_lookup_value (asv,
+           "KeyFileParameters", NULL);
+ 
+       if (v == NULL && intermediate != NULL)
+         {
+           g_assert (g_variant_is_of_type (intermediate,
+                 G_VARIANT_TYPE ("a{ss}")));
+           v = g_variant_lookup_value (intermediate, key + 6,
+               G_VARIANT_TYPE_STRING);
+ 
+           if (v != NULL)
+             ret = g_string_new ("keyfile-escaped ");
+         }
+     }
+   else
+     {
+       v = g_variant_lookup_value (asv, key, NULL);
+     }
+ 
+   if (v != NULL)
+     {
+       ret = g_variant_print_string (v, ret, TRUE);
+       g_variant_unref (v);
+     }
+ 
+   g_variant_unref (asv);
+ 
+   if (ret == NULL)
+     return NULL;
+ 
+   return g_string_free (ret, FALSE);
+ }
+ 
+ gboolean
+ variant_delete (const gchar *account)
+ {
+   gchar *path = get_path (account);
+ 
+   if (g_unlink (path) != 0)
+     {
+       g_warning ("%s", g_strerror (errno));
+       g_free (path);
+       return FALSE;
+     }
+ 
+   g_free (path);
+   return TRUE;
+ }
+ 
+ gboolean
+ variant_exists (const gchar *account)
+ {
+   gchar *path = get_path (account);
+   gboolean ret = g_file_test (path, G_FILE_TEST_EXISTS);
+ 
+   g_free (path);
+   return ret;
+ }
+ 
+ GStrv
+ variant_list (void)
+ {
+   GPtrArray *ret = g_ptr_array_new ();
 -  gchar *dir_path = g_build_filename (g_get_user_data_dir (), "telepathy",
++  gchar *dir_path = g_build_filename (g_get_user_data_dir (), "telepathy-1",
+       "mission-control", NULL);
+   GDir *dir = g_dir_open (dir_path, 0, NULL);
+ 
+   if (dir != NULL)
+     {
+       const gchar *name;
+ 
+       for (name = g_dir_read_name (dir);
+           name != NULL;
+           name = g_dir_read_name (dir))
+         {
+           gchar *dup;
+ 
+           if (!g_str_has_suffix (name, ".account"))
+             continue;
+ 
+           /* this is not production code so we're ignoring the possibility
+            * of invalid account names here */
+           dup = g_strdup (name);
+           g_strdelimit (dup, "-", '/');
+           g_strdelimit (dup, ".", '\0');
+           g_ptr_array_add (ret, dup);
+         }
+ 
+       g_dir_close (dir);
+     }
+ 
+   g_free (dir_path);
+   g_ptr_array_add (ret, NULL);
+   return (GStrv) g_ptr_array_free (ret, FALSE);
+ }
diff --cc tests/twisted/account-manager/request-online.py
index 2503219,1818684..e296b0e
--- a/tests/twisted/account-manager/request-online.py
+++ b/tests/twisted/account-manager/request-online.py
@@@ -50,12 -47,12 +47,12 @@@ def test(q, bus, mc)
      # Create an account
      params = dbus.Dictionary({"account": "someguy at example.com",
          "password": "secrecy"}, signature='sv')
-     (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+     (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
  
 -    # The account is initially valid but disabled, and hence offline
 +    # The account is initially usable but disabled, and hence offline
      props = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE)
      assert not props['Enabled']
 -    assert props['Valid']
 +    assert props['Usable']
      # The spec says it should be (Offline, "", "") but I don't think the
      # strings really matter. If anything, the second one should start out at
      # "offline".
diff --cc tests/twisted/account-storage/default-keyring-storage.py
index b2c6216,27b45e5..0eb83c1
--- a/tests/twisted/account-storage/default-keyring-storage.py
+++ b/tests/twisted/account-storage/default-keyring-storage.py
@@@ -61,18 -61,24 +61,22 @@@ def account_store(op, backend, key=None
  def test(q, bus, mc):
      ctl_dir = os.environ['MC_ACCOUNT_DIR']
      old_key_file_name = os.path.join(ctl_dir, 'accounts.cfg')
-     new_key_file_name = os.path.join(os.environ['XDG_DATA_HOME'],
+     newer_key_file_name = os.path.join(os.environ['XDG_DATA_HOME'],
 -            'telepathy', 'mission-control', 'accounts.cfg')
 +            'telepathy-1', 'mission-control', 'accounts.cfg')
+     new_variant_file_name = os.path.join(os.environ['XDG_DATA_HOME'],
 -            'telepathy', 'mission-control',
++            'telepathy-1', 'mission-control',
+             'fakecm-fakeprotocol-dontdivert_40example_2ecom0.account')
      group = 'fakecm/fakeprotocol/dontdivert_40example_2ecom0'
  
      account_manager, properties, interfaces = connect_to_mc(q, bus, mc)
  
 -    assert properties.get('ValidAccounts') == [], \
 -        properties.get('ValidAccounts')
 -    assert properties.get('InvalidAccounts') == [], \
 -        properties.get('InvalidAccounts')
 +    assertEquals([], properties.get('UsableAccounts'))
 +    assertEquals([], properties.get('UnusableAccounts'))
  
      params = dbus.Dictionary({"account": "dontdivert at example.com",
-         "password": "secrecy"}, signature='sv')
-     (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+         "password": "secrecy",
+         "snakes": dbus.UInt32(23)}, signature='sv')
+     (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
  
      account_path = account.__dbus_object_path__
  
@@@ -144,25 -163,66 +161,66 @@@
      # Tell MC to die, again
      tell_mc_to_die(q, bus)
  
-     low_prio_key_file_name = os.path.join(
+     low_prio_variant_file_name = os.path.join(
              os.environ['XDG_DATA_DIRS'].split(':')[0],
-             'telepathy-1', 'mission-control', 'accounts.cfg')
-     os.makedirs(os.path.dirname(low_prio_key_file_name), 0700)
 -            'telepathy', 'mission-control',
++            'telepathy-1', 'mission-control',
+             'fakecm-fakeprotocol-dontdivert_40example_2ecom0.account')
+     os.makedirs(os.path.dirname(low_prio_variant_file_name), 0700)
  
      # This is deliberately a lower-priority location
-     os.remove(new_key_file_name)
-     open(low_prio_key_file_name, 'w').write(
- r"""# Telepathy accounts
- [%s]
- manager=fakecm
- protocol=fakeprotocol
- param-account=dontdivert at example.com
- param-password=password_in_keyfile
- DisplayName=New and improved account
- AutomaticPresence=2;available;;
- """ % group)
+     open(low_prio_variant_file_name, 'w').write(
+ """{
+ 'manager': <'fakecm'>,
+ 'protocol': <'fakeprotocol'>,
+ 'DisplayName': <'New and improved account'>,
+ 'AutomaticPresence': <(uint32 2, 'available', '')>,
+ 'KeyFileParameters': <{
+     'account': 'dontdivert at example.com',
+     'password': 'password_in_variant_file',
+     'snakes': '42'
+     }>
+ }
+ """)
+ 
+     # This version of this account will be used
+     open(new_variant_file_name.replace('.account', 'priority.account'),
+             'w').write("""{
+ 'manager': <'fakecm'>,
+ 'protocol': <'fakeprotocol'>,
+ 'DisplayName': <'Visible'>,
+ 'AutomaticPresence': <(uint32 2, 'available', '')>,
+ 'KeyFileParameters': <{'account': 'dontdivert at example.com',
+     'password': 'password_in_variant_file'}>
+ }
+ """)
+     # This one won't, because it's "masked" by the higher-priority one
+     open(low_prio_variant_file_name.replace('.account', 'priority.account'),
+             'w').write("""{
+ 'manager': <'fakecm'>,
+ 'protocol': <'fakeprotocol'>,
+ 'DisplayName': <'Hidden'>,
+ 'Nickname': <'Hidden'>,
+ 'AutomaticPresence': <(uint32 2, 'available', '')>,
+ 'KeyFileParameters': <{'account': 'dontdivert at example.com',
+     'password': 'password_in_variant_file'}>
+ }
+ """)
+ 
+     # This empty file is considered to "mask" the lower-priority one
+     open(new_variant_file_name.replace('.account', 'masked.account'),
+             'w').write('')
+     open(low_prio_variant_file_name.replace('.account', 'masked.account'),
+             'w').write("""{
+ 'manager': <'fakecm'>,
+ 'protocol': <'fakeprotocol'>,
+ 'AutomaticPresence': <(uint32 2, 'available', '')>,
+ 'KeyFileParameters': <{'account': 'dontdivert at example.com',
+     'password': 'password_in_variant_file'}>
+ }
+ """)
  
      account_manager, properties, interfaces = resuscitate_mc(q, bus, mc)
 -    assertContains(account_path, properties['ValidAccounts'])
++    assertContains(account_path, properties['UsableAccounts'])
      account = get_fakecm_account(bus, mc, account_path)
      account_iface = dbus.Interface(account, cs.ACCOUNT)
  
@@@ -181,6 -246,22 +244,22 @@@
                  'Parameters' in e.args[0]),
              )
  
+     # test that "masking" works
 -    assertDoesNotContain(account_path + "masked", properties['ValidAccounts'])
++    assertDoesNotContain(account_path + "masked", properties['UsableAccounts'])
+     assertDoesNotContain(account_path + "masked",
 -            properties['InvalidAccounts'])
++            properties['UnusableAccounts'])
+ 
+     # test that priority works
 -    assertContains(account_path + "priority", properties['ValidAccounts'])
++    assertContains(account_path + "priority", properties['UsableAccounts'])
+     priority_account = get_fakecm_account(bus, mc, account_path + "priority")
+     assertEquals('', priority_account.Properties.Get(cs.ACCOUNT, 'Nickname'))
+     assertEquals('Visible',
+             priority_account.Properties.Get(cs.ACCOUNT, 'DisplayName'))
+ 
+     # test what happens when we delete an account that has a lower-priority
+     # "other self"
+     assert priority_account.Remove() is None
+ 
      # Tell MC to die yet again
      tell_mc_to_die(q, bus)
  
diff --cc tests/twisted/mctest.py
index b33c3ac,b093ee8..2846b34
--- a/tests/twisted/mctest.py
+++ b/tests/twisted/mctest.py
@@@ -920,10 -1175,10 +1066,10 @@@ def create_fakecm_account(q, bus, mc, p
      account_manager = AccountManager(bus)
  
      servicetest.call_async(q, account_manager, 'CreateAccount',
-         'fakecm', 'fakeprotocol', 'fakeaccount', params, properties)
+         cm_name, protocol_name, 'fakeaccount', params, properties)
  
 -    validity_changed_pattern = servicetest.EventPattern('dbus-signal',
 -        path=cs.AM_PATH, signal='AccountValidityChanged', interface=cs.AM)
 +    usability_changed_pattern = servicetest.EventPattern('dbus-signal',
 +        path=cs.AM_PATH, signal='AccountUsabilityChanged', interface=cs.AM)
  
      # The spec has no order guarantee here.
      # FIXME: MC ought to also introspect the CM and find out that the params
@@@ -992,16 -1249,20 +1140,20 @@@ def expect_fakecm_connection(q, bus, mc
      expect_before_connect = list(expect_before_connect)
      expect_after_connect = list(expect_after_connect)
  
+     # for simplicity we assume the sort of name that is invariant between
+     # Telepathy 0 and Telepathy 1
+     assert '-' not in protocol_name
+ 
      e = q.expect('dbus-method-call', method='RequestConnection',
-             args=['fakeprotocol', expected_params],
-             destination=cs.tp_name_prefix + '.ConnectionManager.fakecm',
-             path=cs.tp_path_prefix + '/ConnectionManager/fakecm',
-             interface=cs.tp_name_prefix + '.ConnectionManager',
+             args=[protocol_name, expected_params],
+             destination=cs.CM + '.' + cm_name,
+             path='/' + cs.CM.replace('.', '/') + '/' + cm_name,
+             interface=cs.CM,
              handled=False)
  
-     conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol',
+     conn = SimulatedConnection(q, bus, cm_name, protocol_name,
                                 account.object_path.split('/')[-1],
 -            self_ident, has_requests=has_requests, has_presence=has_presence,
 +            self_ident, has_presence=has_presence,
              has_aliasing=has_aliasing, has_avatars=has_avatars,
              avatars_persist=avatars_persist, extra_interfaces=extra_interfaces,
              has_hidden=has_hidden)

-- 
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