summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/Connection_Future.xml110
-rw-r--r--extensions/Makefile.am2
-rw-r--r--extensions/Salut_Plugin_Test.xml27
-rw-r--r--extensions/all.xml2
-rw-r--r--plugins/test.c79
-rw-r--r--plugins/test.h33
6 files changed, 253 insertions, 0 deletions
diff --git a/extensions/Connection_Future.xml b/extensions/Connection_Future.xml
new file mode 100644
index 00000000..11047983
--- /dev/null
+++ b/extensions/Connection_Future.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" ?>
+<node name="/Connection_FUTURE"
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+ >
+ <tp:copyright>Copyright © 2009 Collabora Limited</tp:copyright>
+ <tp:copyright>Copyright © 2009 Nokia Corporation</tp:copyright>
+ <tp:license xmlns="http://www.w3.org/1999/xhtml">
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+ </tp:license>
+ <interface name="org.freedesktop.Telepathy.Connection.FUTURE"
+ tp:causes-havoc='experimental'>
+ <tp:requires interface="org.freedesktop.Telepathy.Connection"/>
+
+ <method name="EnsureSidecar" tp:name-for-bindings="Ensure_Sidecar">
+ <tp:added version="0.19.UNRELEASED"/>
+
+ <arg direction="in" name="Main_Interface" type="s"
+ tp:type="DBus_Interface">
+ <tp:docstring>
+ 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 <tt>com.example.PrivacyLists</tt>.
+ </tp:docstring>
+ </arg>
+
+ <arg direction="out" name="Path" type="o">
+ <tp:docstring>The object path of the sidecar, exported by the same bus
+ name as the Connection to which it is attached.</tp:docstring>
+ </arg>
+ <arg direction="out" name="Properties" type="a{sv}"
+ tp:type="Qualified_Property_Value_Map">
+ <tp:docstring>Immutable properties of the sidecar.</tp:docstring>
+ </arg>
+
+ <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+ <p>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.</p>
+
+ <p>This method may be called at any point during the lifetime of a
+ connection, even before its <tp:type>Connection_Status</tp:type>
+ 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).</p>
+
+ <tp:rationale>
+ <p>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
+ <tp:dbus-ref
+ namespace="org.freedesktop.Telepathy">Channel</tp:dbus-ref>
+ instead.</p>
+ </tp:rationale>
+ </tp:docstring>
+
+ <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
+ <tp:docstring>
+ 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.)
+ </tp:docstring>
+ </tp:error>
+
+ <tp:error name="org.freedesktop.Telepathy.Error.ServiceBusy">
+ <tp:docstring>
+ 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.
+ </tp:docstring>
+ </tp:error>
+
+ <tp:error name="org.freedesktop.Telepathy.Error.Cancelled">
+ <tp:docstring>
+ The connection was disconnected while the sidecar was being set up.
+ </tp:docstring>
+ </tp:error>
+ </method>
+
+ </interface>
+</node>
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index a8b5be22..b5800c13 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -5,6 +5,8 @@ EXTRA_DIST = \
OLPC_Buddy_Info.xml \
OLPC_Activity_Properties.xml \
connection.xml \
+ Salut_Plugin_Test.xml \
+ Connection_Future.xml \
all.xml
noinst_LTLIBRARIES = libsalut-extensions.la
diff --git a/extensions/Salut_Plugin_Test.xml b/extensions/Salut_Plugin_Test.xml
new file mode 100644
index 00000000..265c2a84
--- /dev/null
+++ b/extensions/Salut_Plugin_Test.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<node name="/Salut_Plugin_Test"
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
+ <tp:copyright>Copyright © 2009 Collabora Ltd.</tp:copyright>
+ <tp:license xmlns="http://www.w3.org/1999/xhtml">
+ <p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+ </tp:license>
+ <interface name="org.freedesktop.Telepathy.Salut.Plugin.Test">
+ <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+ <p>A sidecar interface implemented by a plugin used by the test
+ suite.</p>
+ </tp:docstring>
+ </interface>
+</node>
+<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/extensions/all.xml b/extensions/all.xml
index 1a5a7eca..cc33a1c8 100644
--- a/extensions/all.xml
+++ b/extensions/all.xml
@@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p>
<xi:include href="connection.xml"/>
<xi:include href="Connection_Interface_Contact_Capabilities.xml"/>
+<xi:include href="Salut_Plugin_Test.xml"/>
+<xi:include href="Connection_Future.xml"/>
<tp:generic-types>
<tp:external-type name="Contact_Handle" type="u"
diff --git a/plugins/test.c b/plugins/test.c
index 7271d9ba..9d47d949 100644
--- a/plugins/test.c
+++ b/plugins/test.c
@@ -4,6 +4,8 @@
#include <salut/plugin.h>
+#include "extensions/extensions.h"
+
#define DEBUG(msg, ...) \
g_debug ("%s: " msg, G_STRFUNC, ##__VA_ARGS__)
@@ -11,6 +13,13 @@ static void plugin_iface_init (
gpointer g_iface,
gpointer data);
+#define IFACE_TEST "org.freedesktop.Telepathy.Salut.Plugin.Test"
+
+static const gchar * const sidecar_interfaces[] = {
+ IFACE_TEST,
+ NULL
+};
+
G_DEFINE_TYPE_WITH_CODE (TestPlugin, test_plugin, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (SALUT_TYPE_PLUGIN, plugin_iface_init);
)
@@ -47,6 +56,40 @@ create_channel_managers (SalutPlugin *plugin,
}
static void
+test_plugin_create_sidecar (
+ SalutPlugin *plugin,
+ const gchar *sidecar_interface,
+ SalutConnection *connection,
+ WockySession *session,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin),
+ callback, user_data,
+ /* sic: all plugins share salut_plugin_create_sidecar_finish() so we
+ * need to use the same source tag.
+ */
+ salut_plugin_create_sidecar_async);
+ SalutSidecar *sidecar = NULL;
+
+ if (!tp_strdiff (sidecar_interface, IFACE_TEST))
+ {
+ sidecar = g_object_new (TEST_TYPE_SIDECAR, NULL);
+ }
+ else
+ {
+ g_simple_async_result_set_error (result, TP_ERRORS,
+ TP_ERROR_NOT_IMPLEMENTED, "'%s' not implemented", sidecar_interface);
+ }
+
+ if (sidecar != NULL)
+ g_simple_async_result_set_op_res_gpointer (result, sidecar, g_object_unref);
+
+ g_simple_async_result_complete_in_idle (result);
+ g_object_unref (result);
+}
+
+static void
plugin_iface_init (
gpointer g_iface,
gpointer data G_GNUC_UNUSED)
@@ -57,6 +100,8 @@ plugin_iface_init (
iface->name = "Salut test plugin";
iface->version = PACKAGE_VERSION;
+ iface->sidecar_interfaces = sidecar_interfaces;
+ iface->create_sidecar = test_plugin_create_sidecar;
iface->initialize = initialize;
iface->create_channel_managers = create_channel_managers;
}
@@ -66,3 +111,37 @@ salut_plugin_create ()
{
return g_object_new (test_plugin_get_type (), NULL);
}
+
+/******************************
+ * TestSidecar implementation *
+ ******************************/
+
+static void sidecar_iface_init (
+ gpointer g_iface,
+ gpointer data);
+
+G_DEFINE_TYPE_WITH_CODE (TestSidecar, test_sidecar, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (SALUT_TYPE_SIDECAR, sidecar_iface_init);
+ G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_SALUT_PLUGIN_TEST, NULL);
+ )
+
+static void
+test_sidecar_init (TestSidecar *object)
+{
+ DEBUG ("%p", object);
+}
+
+static void
+test_sidecar_class_init (TestSidecarClass *klass)
+{
+}
+
+static void sidecar_iface_init (
+ gpointer g_iface,
+ gpointer data)
+{
+ SalutSidecarInterface *iface = g_iface;
+
+ iface->interface = IFACE_TEST;
+ iface->get_immutable_properties = NULL;
+}
diff --git a/plugins/test.h b/plugins/test.h
index 13e11e4c..a37d19a4 100644
--- a/plugins/test.h
+++ b/plugins/test.h
@@ -1,5 +1,6 @@
#include <glib-object.h>
+/* plugin */
typedef struct _TestPluginClass TestPluginClass;
typedef struct _TestPlugin TestPlugin;
@@ -30,3 +31,35 @@ GType test_plugin_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_PLUGIN, \
TestPluginClass))
+
+/* Sidecar */
+typedef struct _TestSidecarClass TestSidecarClass;
+typedef struct _TestSidecar TestSidecar;
+
+struct _TestSidecarClass
+{
+ GObjectClass parent;
+};
+
+struct _TestSidecar
+{
+ GObject parent;
+};
+
+GType test_sidecar_get_type (void);
+
+#define TEST_TYPE_SIDECAR \
+ (test_sidecar_get_type ())
+#define TEST_SIDECAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_SIDECAR, TestSidecar))
+#define TEST_SIDECAR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), TEST_TYPE_SIDECAR, \
+ TestSidecarClass))
+#define TEST_IS_SIDECAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEST_TYPE_SIDECAR))
+#define TEST_IS_SIDECAR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), TEST_TYPE_SIDECAR))
+#define TEST_SIDECAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SIDECAR, \
+ TestSidecarClass))
+