diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-08 16:54:10 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-08 16:56:18 +0100 |
commit | 31b5eec29cf8e8a0d8ea503d4cc70055d003acfc (patch) | |
tree | 694a978ff9b9e4c82c8335735395c9d8ad89cb3d | |
parent | ab92d3f1f2775854fbe801023a04df6839d639ac (diff) |
Remove support for archaic Capabilities interface
No, not ContactCapabilities, Capabilities...
-rw-r--r-- | src/mcd-connection.c | 52 | ||||
-rw-r--r-- | src/mcd-dispatcher-priv.h | 5 | ||||
-rw-r--r-- | src/mcd-dispatcher.c | 61 | ||||
-rw-r--r-- | tests/twisted/Makefile.am | 1 | ||||
-rw-r--r-- | tests/twisted/capabilities/legacy-caps.py | 85 |
5 files changed, 0 insertions, 204 deletions
diff --git a/src/mcd-connection.c b/src/mcd-connection.c index 481758d5..ea2c41b1 100644 --- a/src/mcd-connection.c +++ b/src/mcd-connection.c @@ -592,55 +592,6 @@ _foreach_channel_remove (McdMission * mission, McdOperation * operation) } static void -capabilities_advertise_cb (TpConnection *proxy, const GPtrArray *out0, - const GError *error, gpointer user_data, - GObject *weak_object) -{ - if (error) - { - g_warning ("%s: AdvertiseCapabilities failed: %s", G_STRFUNC, error->message); - } - -} - -static void -_mcd_connection_setup_capabilities (McdConnection *connection) -{ - McdConnectionPrivate *priv = MCD_CONNECTION_PRIV (connection); - GPtrArray *capabilities; - const gchar *removed = NULL; - GType type; - guint i; - - if (priv->has_contact_capabilities_if) - { - DEBUG ("ContactCapabilities in use, avoiding Capabilities"); - return; - } - - if (!priv->has_capabilities_if) - { - DEBUG ("connection does not support capabilities interface"); - return; - } - capabilities = _mcd_dispatcher_get_channel_capabilities (priv->dispatcher); - DEBUG ("advertising capabilities"); - tp_cli_connection_interface_capabilities_call_advertise_capabilities (priv->tp_conn, -1, - capabilities, - &removed, - capabilities_advertise_cb, - priv, NULL, - (GObject *) connection); - - /* free the connection capabilities */ - type = dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, - G_TYPE_UINT, G_TYPE_INVALID); - for (i = 0; i < capabilities->len; i++) - g_boxed_free (type, g_ptr_array_index (capabilities, i)); - g_ptr_array_unref (capabilities); -} - -static void avatars_set_avatar_cb (TpConnection *proxy, const gchar *token, const GError *error, gpointer user_data, GObject *weak_object) @@ -1603,9 +1554,6 @@ on_connection_ready (GObject *source_object, GAsyncResult *result, if (priv->has_presence_if) _mcd_connection_setup_presence (connection); - if (priv->has_capabilities_if) - _mcd_connection_setup_capabilities (connection); - if (priv->has_avatars_if) _mcd_connection_setup_avatar (connection); diff --git a/src/mcd-dispatcher-priv.h b/src/mcd-dispatcher-priv.h index 16d3a821..82c7ad42 100644 --- a/src/mcd-dispatcher-priv.h +++ b/src/mcd-dispatcher-priv.h @@ -33,11 +33,6 @@ G_BEGIN_DECLS -/* retrieves the channel handlers' capabilities, in a format suitable for being - * used as a parameter for the telepathy "AdvertiseCapabilities" method */ -G_GNUC_INTERNAL GPtrArray *_mcd_dispatcher_get_channel_capabilities ( - McdDispatcher *dispatcher); - /* not exported */ G_GNUC_INTERNAL void _mcd_dispatcher_take_channels ( McdDispatcher *dispatcher, GList *channels, gboolean requested, diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index 12be1c7e..42fbbd6e 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -1027,26 +1027,6 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass) } static void -_build_channel_capabilities (const gchar *channel_type, guint type_flags, - GPtrArray *capabilities) -{ - GValue cap = {0,}; - GType cap_type; - - cap_type = dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, - G_TYPE_UINT, G_TYPE_INVALID); - g_value_init (&cap, cap_type); - g_value_take_boxed (&cap, dbus_g_type_specialized_construct (cap_type)); - - dbus_g_type_struct_set (&cap, - 0, channel_type, - 1, type_flags, - G_MAXUINT); - - g_ptr_array_add (capabilities, g_value_get_boxed (&cap)); -} - -static void mcd_dispatcher_init (McdDispatcher * dispatcher) { McdDispatcherPrivate *priv; @@ -1321,47 +1301,6 @@ mcd_dispatcher_context_get_channel_by_type (McdDispatcherContext *context, return NULL; } -GPtrArray * -_mcd_dispatcher_get_channel_capabilities (McdDispatcher *dispatcher) -{ - McdDispatcherPrivate *priv = dispatcher->priv; - GPtrArray *channel_handler_caps; - GHashTableIter iter; - gpointer key, value; - - channel_handler_caps = g_ptr_array_new (); - - /* Add the capabilities from the new-style clients */ - _mcd_client_registry_init_hash_iter (priv->clients, &iter); - while (g_hash_table_iter_next (&iter, &key, &value)) - { - McdClientProxy *client = value; - const GList *list; - - for (list = _mcd_client_proxy_get_handler_filters (client); - list != NULL; - list = list->next) - { - GHashTable *channel_class = list->data; - const gchar *channel_type; - guint type_flags; - - channel_type = tp_asv_get_string (channel_class, - TP_IFACE_CHANNEL ".ChannelType"); - if (!channel_type) continue; - - /* There is currently no way to map the HandlerChannelFilter client - * property into type-specific capabilities. Let's pretend we - * support everything. */ - type_flags = 0xffffffff; - - _build_channel_capabilities (channel_type, type_flags, - channel_handler_caps); - } - } - return channel_handler_caps; -} - /* * _mcd_dispatcher_take_channels: * @dispatcher: the #McdDispatcher. diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 642e9814..7ca1de47 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -23,7 +23,6 @@ TWISTED_BASIC_TESTS = \ account-requests/delete-account-during-request.py \ account/addressing.py \ capabilities/contact-caps.py \ - capabilities/legacy-caps.py \ dispatcher/already-has-channel.py \ dispatcher/already-has-obsolete.py \ dispatcher/approver-fails.py \ diff --git a/tests/twisted/capabilities/legacy-caps.py b/tests/twisted/capabilities/legacy-caps.py deleted file mode 100644 index 81d99ab6..00000000 --- a/tests/twisted/capabilities/legacy-caps.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2009 Nokia Corporation -# Copyright (C) 2009 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 - -import dbus - -"""Regression test for pushing clients' capabilities into an old CM, with only -the old Capabilities interface. -""" - -import dbus -import dbus.service - -from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \ - call_async -from mctest import exec_test, SimulatedConnection, SimulatedClient, \ - create_fakecm_account, enable_fakecm_account, SimulatedChannel, \ - expect_client_setup -import constants as cs - -def test(q, bus, mc): - # Two clients want to handle channels: MediaCall is running, and AbiWord - # is activatable. - - media_fixed_properties = dbus.Dictionary({ - cs.CHANNEL + '.ChannelType': cs.CHANNEL_TYPE_STREAMED_MEDIA, - }, signature='sv') - media_call = SimulatedClient(q, bus, 'MediaCall', - observe=[], approve=[], - handle=[media_fixed_properties], bypass_approval=False) - - # wait for MC to download the properties - expect_client_setup(q, [media_call]) - - def check_legacy_caps(e): - # Because MC has no idea how to map Client capabilities into legacy - # capabilities, it assumes that every client has all the flags in - # the world. In this example we have (only) a StreamedMedia client - # and a stream-tube client, so that's what MC will tell us. - add = e.args[0] - remove = e.args[1] - - assert (cs.CHANNEL_TYPE_STREAMED_MEDIA, 2L**32-1) in add - assert (cs.CHANNEL_TYPE_STREAM_TUBE, 2L**32-1) in add - - # MC puts StreamTube in the list twice - arguably a bug, but - # CMs should cope. So, don't assert about the length of the list - for item in add: - assert item in ( - (cs.CHANNEL_TYPE_STREAMED_MEDIA, 2L**32-1), - (cs.CHANNEL_TYPE_STREAM_TUBE, 2L**32-1), - ) - - assert len(remove) == 0 - - return True - - params = dbus.Dictionary({"account": "someguy@example.com", - "password": "secrecy"}, signature='sv') - cm_name_ref, account = create_fakecm_account(q, bus, mc, params) - conn = enable_fakecm_account(q, bus, mc, account, params, - extra_interfaces=[cs.CONN_IFACE_CAPS], - expect_after_connect=[ - EventPattern('dbus-method-call', handled=False, - interface=cs.CONN_IFACE_CAPS, - method='AdvertiseCapabilities', - predicate=check_legacy_caps), - ]) - -if __name__ == '__main__': - exec_test(test, {}) |