[telepathy-salut/master] factor out handle_stream_tube_channel_request

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


---
 src/salut-muc-manager.c |   55 +++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/src/salut-muc-manager.c b/src/salut-muc-manager.c
index c66d2c6..310e33d 100644
--- a/src/salut-muc-manager.c
+++ b/src/salut-muc-manager.c
@@ -790,6 +790,37 @@ handle_tube_channel_request (SalutMucManager *self,
 }
 
 static gboolean
+handle_stream_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_stream_channel_get_allowed_properties (),
+          error))
+    return FALSE;
+
+  /* "Service" is a mandatory, not-fixed property */
+  service = tp_asv_get_string (request_properties,
+            TP_IFACE_CHANNEL_TYPE_STREAM_TUBE ".Service");
+  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_STREAM_TUBE ".Service");
+      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,
@@ -889,27 +920,9 @@ salut_muc_manager_request (SalutMucManager *self,
     }
   else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE))
     {
-      const gchar *service;
-
-      if (tp_channel_manager_asv_has_unknown_properties (request_properties,
-              muc_tubes_channel_fixed_properties,
-              salut_tube_stream_channel_get_allowed_properties (),
-              &error))
-        goto error;
-
-      /* "Service" is a mandatory, not-fixed property */
-      service = tp_asv_get_string (request_properties,
-                TP_IFACE_CHANNEL_TYPE_STREAM_TUBE ".Service");
-      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_STREAM_TUBE ".Service");
-          goto error;
-        }
-
-      return handle_tube_channel_request (self, request_token,
-          request_properties, require_new, handle, &error);
+      if (handle_stream_tube_channel_request (self, request_token,
+          request_properties, require_new, handle, &error))
+        return TRUE;
     }
   else
     {
-- 
1.5.6.5




More information about the telepathy-commits mailing list