[Telepathy-commits] [telepathy-salut/master] pass request properties to salut_tubes_channel_tube_request so we don't have to fetch them twice

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Thu Feb 5 07:04:52 PST 2009


---
 src/salut-tubes-channel.c |   19 +++----------------
 src/salut-tubes-channel.h |    2 +-
 src/salut-tubes-manager.c |   11 +++++++----
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/salut-tubes-channel.c b/src/salut-tubes-channel.c
index 3895200..09f44ed 100644
--- a/src/salut-tubes-channel.c
+++ b/src/salut-tubes-channel.c
@@ -982,44 +982,31 @@ generate_tube_id (void)
 
 SalutTubeIface *
 salut_tubes_channel_tube_request (SalutTubesChannel *self,
-                                  gpointer request_token,
-                                  GHashTable *request_properties)
+                                  const gchar *channel_type,
+                                  const gchar *service,
+                                  GHashTable *parameters)
 {
   SalutTubesChannelPrivate *priv = SALUT_TUBES_CHANNEL_GET_PRIVATE (self);
   SalutTubeIface *tube;
-  const gchar *channel_type;
-  const gchar *service;
-  GHashTable *parameters = NULL;
   guint tube_id;
   TpTubeType type;
 
   tube_id = generate_tube_id ();
 
-  channel_type = tp_asv_get_string (request_properties,
-            TP_IFACE_CHANNEL ".ChannelType");
-
   if (!tp_strdiff (channel_type, SALUT_IFACE_CHANNEL_TYPE_STREAM_TUBE))
     {
       type = TP_TUBE_TYPE_STREAM;
-      service = tp_asv_get_string (request_properties,
-                SALUT_IFACE_CHANNEL_TYPE_STREAM_TUBE ".Service");
-
     }
 /* Temporarily disabled since the implementation is incomplete */
 #if 0
   else if (!tp_strdiff (channel_type, SALUT_IFACE_CHANNEL_TYPE_DBUS_TUBE))
     {
       type = TP_TUBE_TYPE_DBUS;
-      service = tp_asv_get_string (request_properties,
-                SALUT_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName");
     }
 #endif
   else
     g_assert_not_reached ();
 
-  parameters = tp_asv_get_boxed (request_properties,
-               SALUT_IFACE_CHANNEL_INTERFACE_TUBE ".Parameters",
-               TP_HASH_TYPE_STRING_VARIANT_MAP);
   if (parameters == NULL)
     {
       /* If it is not included in the request, the connection manager MUST
diff --git a/src/salut-tubes-channel.h b/src/salut-tubes-channel.h
index 36a98be..e463caf 100644
--- a/src/salut-tubes-channel.h
+++ b/src/salut-tubes-channel.h
@@ -86,7 +86,7 @@ void salut_tubes_channel_message_close_received (SalutTubesChannel *self,
     TpHandle initiator_handle, guint tube_id);
 
 SalutTubeIface *salut_tubes_channel_tube_request (SalutTubesChannel *self,
-    gpointer request_token, GHashTable *request_properties);
+    const gchar *channel_type, const gchar *service, GHashTable *parameters);
 
 void salut_tubes_channel_send_iq_offer (SalutTubesChannel *self);
 
diff --git a/src/salut-tubes-manager.c b/src/salut-tubes-manager.c
index 1a289ec..2e75a09 100644
--- a/src/salut-tubes-manager.c
+++ b/src/salut-tubes-manager.c
@@ -817,6 +817,7 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
   GError *error = NULL;
   const gchar *channel_type;
   SalutTubesChannel *tubes_channel;
+  const gchar *service;
 
   if (tp_asv_get_uint32 (request_properties,
         TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT)
@@ -841,8 +842,6 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
     }
   else if (!tp_strdiff (channel_type, SALUT_IFACE_CHANNEL_TYPE_STREAM_TUBE))
     {
-      const gchar *service;
-
       if (tp_channel_manager_asv_has_unknown_properties (request_properties,
               tubes_channel_fixed_properties,
               stream_tube_channel_allowed_properties,
@@ -864,7 +863,6 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
 #if 0
   else if (!tp_strdiff (channel_type, SALUT_IFACE_CHANNEL_TYPE_DBUS_TUBE))
     {
-      const gchar *service;
       GError *err = NULL;
 
       if (tp_channel_manager_asv_has_unknown_properties (request_properties,
@@ -941,6 +939,7 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
     {
       SalutTubeIface *new_channel;
       GSList *tokens = NULL;
+      GHashTable *parameters;
 
       if (tubes_channel == NULL)
         {
@@ -950,8 +949,12 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
             goto error;
         }
 
+      parameters = tp_asv_get_boxed (request_properties,
+          SALUT_IFACE_CHANNEL_INTERFACE_TUBE ".Parameters",
+          TP_HASH_TYPE_STRING_VARIANT_MAP);
+
       new_channel = salut_tubes_channel_tube_request (tubes_channel,
-          request_token, request_properties);
+          channel_type, service, parameters);
       g_assert (new_channel != NULL);
 
       if (request_token != NULL)
-- 
1.5.6.5



More information about the telepathy-commits mailing list