From 11a78c3808d60f2b822d5afbf8a38bfc4afde130 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 7 Feb 2014 13:05:39 +0000 Subject: [PATCH 2/2] Use telepathy-glib for Sidecars1 interface --- extensions/Connection_Future.xml | 110 --------------------------------------- extensions/Makefile.am | 1 - extensions/all.xml | 1 - src/connection.c | 20 +++---- tests/twisted/sidecars.py | 10 ++-- 5 files changed, 15 insertions(+), 127 deletions(-) delete mode 100644 extensions/Connection_Future.xml diff --git a/extensions/Connection_Future.xml b/extensions/Connection_Future.xml deleted file mode 100644 index 1104798..0000000 --- a/extensions/Connection_Future.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - Copyright © 2009 Collabora Limited - Copyright © 2009 Nokia Corporation - -

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 Street, Fifth Floor, Boston, MA 02110-1301, -USA.

-
- - - - - - - - - The "primary" interface implemented by an object attached - to a connection. For example, a Gabble plugin implementing - fine-grained control of XEP-0016 privacy lists might expose an object - implementing com.example.PrivacyLists. - - - - - The object path of the sidecar, exported by the same bus - name as the Connection to which it is attached. - - - Immutable properties of the sidecar. - - - -

Request an object with a particular interface providing additional - connection-specific functionality, together with its immutable - properties. These will often be implemented by plug-ins to the - connection managers; for example, support for an XMPP XEP for which - no generic Telepathy interface exists might be implemented by a - Gabble plugin exposing a sidecar with a particular interface.

- -

This method may be called at any point during the lifetime of a - connection, even before its Connection_Status - changes to Connected. It MAY take a long time to - return—perhaps it needs to wait for a connection to be established - and for all the services supported by the server to be discovered - before determining whether necessary server-side support is - available—so callers SHOULD override the default method timeout (25 - seconds) with a much higher value (perhaps even MAX_INT32, meaning - “no timeout” in recent versions of libdbus).

- - -

There is an implicit assumption that any connection - manager plugin will only want to export one “primary” object per - feature it implements, since there is a one-to-one mapping between - interface and object. This is reasonable since Sidecars are - (intended to be) analogous to extra interfaces on the connection, - providing once-per-connection shared functionality; it also makes - client code straightforward (look up the interface you care about - in a dictionary, build a proxy object from the value). More - “plural” plugins are likely to want to implement new types of - Channel - instead.

-
-
- - - - The requested sidecar is not implemented by this connection manager, - or a necessary server-side component does not exist. (FIXME: split - these two errors out? Then again, once we list the guaranteed and - possible sidecars on a Protocol object, clients can tell the - difference themselves, because they shouldn't be calling this in the - first case.) - - - - - - A server-side component needed by the requested sidecar reported it - is currently too busy, or did not respond for some - implementation-defined time. The caller may wish to try again later. - - - - - - The connection was disconnected while the sidecar was being set up. - - -
- -
-
diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 39f94e9..288894c 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -5,7 +5,6 @@ EXTRA_DIST = \ OLPC_Activity_Properties.xml \ connection.xml \ Salut_Plugin_Test.xml \ - Connection_Future.xml \ all.xml noinst_LTLIBRARIES = libsalut-extensions.la diff --git a/extensions/all.xml b/extensions/all.xml index befed66..65951e1 100644 --- a/extensions/all.xml +++ b/extensions/all.xml @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

- next) - salut_svc_connection_future_return_from_ensure_sidecar (l->data, + tp_svc_connection_interface_sidecars1_return_from_ensure_sidecar (l->data, path, props); g_hash_table_unref (props); @@ -3987,7 +3987,7 @@ out: static void salut_connection_ensure_sidecar ( - SalutSvcConnectionFUTURE *iface, + TpSvcConnectionInterfaceSidecars1 *iface, const gchar *sidecar_iface, DBusGMethodInvocation *context) { @@ -4026,7 +4026,7 @@ salut_connection_ensure_sidecar ( GHashTable *props = salut_sidecar_get_immutable_properties (sidecar); DEBUG ("sidecar %s already exists at %s", sidecar_iface, path); - salut_svc_connection_future_return_from_ensure_sidecar (context, path, + tp_svc_connection_interface_sidecars1_return_from_ensure_sidecar (context, path, props); g_free (path); @@ -4130,13 +4130,13 @@ sidecars_conn_status_changed_cb ( } static void -salut_conn_future_iface_init (gpointer g_iface, +salut_conn_sidecars_iface_init (gpointer g_iface, gpointer iface_data) { - SalutSvcConnectionFUTUREClass *klass = g_iface; + TpSvcConnectionInterfaceSidecars1Class *klass = g_iface; #define IMPLEMENT(x) \ - salut_svc_connection_future_implement_##x (\ + tp_svc_connection_interface_sidecars1_implement_##x (\ klass, salut_connection_##x) IMPLEMENT(ensure_sidecar); #undef IMPLEMENT diff --git a/tests/twisted/sidecars.py b/tests/twisted/sidecars.py index 26a7b67..70627db 100644 --- a/tests/twisted/sidecars.py +++ b/tests/twisted/sidecars.py @@ -18,7 +18,7 @@ if not PLUGINS_ENABLED: def test(q, bus, conn): # Request a sidecar thate we support before we're connected; it should just # wait around until we're connected. - call_async(q, conn.Future, 'EnsureSidecar', TEST_PLUGIN_IFACE) + call_async(q, conn.Sidecars1, 'EnsureSidecar', TEST_PLUGIN_IFACE) conn.Connect() @@ -30,18 +30,18 @@ def test(q, bus, conn): assertEquals({}, props) # We should get the same sidecar if we request it again - path2, props2 = conn.Future.EnsureSidecar(TEST_PLUGIN_IFACE) + path2, props2 = conn.Sidecars1.EnsureSidecar(TEST_PLUGIN_IFACE) assertEquals((path, props), (path2, props2)) else: # Only now does it fail. q.expect('dbus-error', method='EnsureSidecar') # This is not a valid interface name - call_async(q, conn.Future, 'EnsureSidecar', 'not an interface') + call_async(q, conn.Sidecars1, 'EnsureSidecar', 'not an interface') q.expect('dbus-error', name=cs.INVALID_ARGUMENT) # The test plugin makes no reference to this interface. - call_async(q, conn.Future, 'EnsureSidecar', 'unsupported.sidecar') + call_async(q, conn.Sidecars1, 'EnsureSidecar', 'unsupported.sidecar') q.expect('dbus-error', name=cs.NOT_IMPLEMENTED) call_async(q, conn, 'Disconnect') @@ -51,7 +51,7 @@ def test(q, bus, conn): args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_REQUESTED]), ) - call_async(q, conn.Future, 'EnsureSidecar', 'zomg.what') + call_async(q, conn.Sidecars1, 'EnsureSidecar', 'zomg.what') # With older telepathy-glib this would be DISCONNECTED; # with newer telepathy-glib the Connection disappears from the bus # sooner, and you get UnknownMethod or something from dbus-glib. -- 1.9.rc1