[Telepathy-commits] [telepathy-glib/master] ChannelManager: add ensure_channel method to vtable

Will Thompson will.thompson at collabora.co.uk
Wed Sep 17 15:35:13 PDT 2008


---
 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/channel-manager.c           |   36 ++++++++++++++++++++++++++++
 telepathy-glib/channel-manager.h           |    8 ++++--
 3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index d755352..8244bbf 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -132,6 +132,7 @@ tp_channel_manager_emit_new_channels
 tp_channel_manager_emit_request_already_satisfied
 tp_channel_manager_emit_request_failed
 tp_channel_manager_emit_request_failed_printf
+tp_channel_manager_ensure_channel
 tp_channel_manager_foreach_channel
 tp_channel_manager_foreach_channel_class
 tp_channel_manager_request_channel
diff --git a/telepathy-glib/channel-manager.c b/telepathy-glib/channel-manager.c
index 2e2d923..f6b6d71 100644
--- a/telepathy-glib/channel-manager.c
+++ b/telepathy-glib/channel-manager.c
@@ -151,6 +151,10 @@
  * @request_channel: Respond to a request for a (new or existing) channel made
  *  with the Connection.RequestChannel method. See #TpChannelManagerRequestFunc
  *  for details.
+ * @ensure_channel: Respond to a request for a (new or existing) channel made
+ *  with the Connection.Interface.Requests.EnsureChannel method. See
+ *  #TpChannelManagerRequestFunc for details.
+ *  Since: 0.7.UNRELEASED+1
  *
  * The vtable for a channel manager implementation.
  *
@@ -624,6 +628,38 @@ tp_channel_manager_request_channel (TpChannelManager *manager,
 
 
 /**
+ * tp_channel_manager_ensure_channel:
+ * @manager: An object implementing #TpChannelManager
+ * @request_token: An opaque pointer representing this pending request.
+ * @request_properties: A table mapping (const gchar *) property names to
+ *  GValue, representing the desired properties of a channel requested by a
+ *  Telepathy client.
+ *
+ * Offers an incoming EnsureChannel call to @manager.
+ *
+ * Returns: %TRUE if this request will be handled by @manager; else %FALSE.
+ *
+ * Since: 0.7.UNRELEASED+1
+ */
+gboolean
+tp_channel_manager_ensure_channel (TpChannelManager *manager,
+                                   gpointer request_token,
+                                   GHashTable *request_properties)
+{
+  TpChannelManagerIface *iface = TP_CHANNEL_MANAGER_GET_INTERFACE (
+      manager);
+  TpChannelManagerRequestFunc method = iface->ensure_channel;
+
+  /* A missing implementation is equivalent to one that always returns FALSE,
+   * meaning "can't do that, ask someone else" */
+  if (method != NULL)
+    return method (manager, request_token, request_properties);
+  else
+    return FALSE;
+}
+
+
+/**
  * tp_channel_manager_asv_has_unknown_properties:
  * @properties: a table mapping (const gchar *) property names to GValues,
  *              as passed to methods of #TpChannelManager
diff --git a/telepathy-glib/channel-manager.h b/telepathy-glib/channel-manager.h
index e1b58e3..77bcd29 100644
--- a/telepathy-glib/channel-manager.h
+++ b/telepathy-glib/channel-manager.h
@@ -82,6 +82,9 @@ gboolean tp_channel_manager_create_channel (TpChannelManager *manager,
 gboolean tp_channel_manager_request_channel (TpChannelManager *manager,
     gpointer request_token, GHashTable *request_properties);
 
+gboolean tp_channel_manager_ensure_channel (TpChannelManager *manager,
+    gpointer request_token, GHashTable *request_properties);
+
 
 struct _TpChannelManagerIface {
     GTypeInterface parent;
@@ -92,13 +95,12 @@ struct _TpChannelManagerIface {
 
     TpChannelManagerRequestFunc create_channel;
     TpChannelManagerRequestFunc request_channel;
-    /* in principle we could have EnsureChannel here too */
+    TpChannelManagerRequestFunc ensure_channel;
 
     /*<private>*/
-    /* We know that these three methods will be added in the near future, so
+    /* We know that these two methods will be added in the near future, so
      * reserve extra space for them.
      */
-    GCallback _reserved_for_ensure_channel;
     GCallback _reserved_for_foreach_contact_channel_class;
     GCallback _reserved_for_add_cap;
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list