telepathy-mission-control: Remove support for archaic Capabilities interface
Simon McVittie
smcv at kemper.freedesktop.org
Thu May 10 08:15:15 PDT 2012
Module: telepathy-mission-control
Branch: master
Commit: 31b5eec29cf8e8a0d8ea503d4cc70055d003acfc
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=31b5eec29cf8e8a0d8ea503d4cc70055d003acfc
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Tue May 8 16:54:10 2012 +0100
Remove support for archaic Capabilities interface
No, not ContactCapabilities, Capabilities...
---
src/mcd-connection.c | 52 ------------------
src/mcd-dispatcher-priv.h | 5 --
src/mcd-dispatcher.c | 61 ---------------------
tests/twisted/Makefile.am | 1 -
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 481758d..ea2c41b 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 16d3a82..82c7ad4 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 12be1c7..42fbbd6 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 642e981..7ca1de4 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 81d99ab..0000000
--- 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 at 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, {})
More information about the telepathy-commits
mailing list