[telepathy-salut/master] salut-muc-manager: handle D-Bus tube channel request

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Jun 26 07:28:10 PDT 2009


---
 src/salut-muc-manager.c |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/src/salut-muc-manager.c b/src/salut-muc-manager.c
index 310e33d..79cc8ae 100644
--- a/src/salut-muc-manager.c
+++ b/src/salut-muc-manager.c
@@ -821,6 +821,37 @@ handle_stream_tube_channel_request (SalutMucManager *self,
 }
 
 static gboolean
+handle_dbus_tube_channel_request (SalutMucManager *self,
+    gpointer request_token,
+    GHashTable *request_properties,
+    gboolean require_new,
+    TpHandle handle,
+    GError **error)
+{
+  const gchar *service;
+
+  if (tp_channel_manager_asv_has_unknown_properties (request_properties,
+          muc_tubes_channel_fixed_properties,
+          salut_tube_dbus_channel_get_allowed_properties (),
+          error))
+    return FALSE;
+
+  /* "ServiceName" is a mandatory, not-fixed property */
+  service = tp_asv_get_string (request_properties,
+      TP_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName");
+  if (service == NULL)
+    {
+      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
+          "Request does not contain the mandatory property '%s'",
+          TP_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName");
+      return FALSE;
+    }
+
+  return handle_tube_channel_request (self, request_token, request_properties,
+      require_new, handle, error);
+}
+
+static gboolean
 salut_muc_manager_request (SalutMucManager *self,
                            gpointer request_token,
                            GHashTable *request_properties,
@@ -843,7 +874,8 @@ salut_muc_manager_request (SalutMucManager *self,
 
   if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT) &&
       tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TUBES) &&
-      tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE))
+      tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE) &&
+      tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE))
     return FALSE;
 
   /* validity already checked by TpBaseConnection */
@@ -924,6 +956,12 @@ salut_muc_manager_request (SalutMucManager *self,
           request_properties, require_new, handle, &error))
         return TRUE;
     }
+  else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE))
+    {
+      if (handle_dbus_tube_channel_request (self, request_token,
+          request_properties, require_new, handle, &error))
+        return TRUE;
+    }
   else
     {
       return FALSE;
-- 
1.5.6.5




More information about the telepathy-commits mailing list