[Telepathy-commits] [telepathy-gabble/master] Advertise D-Bus tube capabilities

Alban Crequy alban.crequy at collabora.co.uk
Fri Dec 5 09:42:28 PST 2008


---
 src/private-tubes-factory.c |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c
index 1112172..4ba1fca 100644
--- a/src/private-tubes-factory.c
+++ b/src/private-tubes-factory.c
@@ -370,7 +370,6 @@ gabble_private_tubes_factory_get_contact_caps (GabbleChannelManager *manager,
                                                TpHandle handle,
                                                GPtrArray *arr)
 {
-  GValue monster = {0, };
   GHashTable *fixed_properties;
   GValue *channel_type_value;
   GValue *target_handle_type_value;
@@ -397,6 +396,7 @@ gabble_private_tubes_factory_get_contact_caps (GabbleChannelManager *manager,
   g_hash_table_iter_init (&tube_caps_iter, presence->stream_tube_caps);
   while (g_hash_table_iter_next (&tube_caps_iter, &service, &dummy)) 
     {
+      GValue monster = {0, };
       g_value_init (&monster, GABBLE_STRUCT_TYPE_ENHANCED_CONTACT_CAPABILITY);
       g_value_take_boxed (&monster,
           dbus_g_type_specialized_construct (
@@ -432,6 +432,46 @@ gabble_private_tubes_factory_get_contact_caps (GabbleChannelManager *manager,
 
       g_ptr_array_add (arr, g_value_get_boxed (&monster));
     }
+
+  g_hash_table_iter_init (&tube_caps_iter, presence->dbus_tube_caps);
+  while (g_hash_table_iter_next (&tube_caps_iter, &service, &dummy)) 
+    {
+      GValue monster = {0, };
+      g_value_init (&monster, GABBLE_STRUCT_TYPE_ENHANCED_CONTACT_CAPABILITY);
+      g_value_take_boxed (&monster,
+          dbus_g_type_specialized_construct (
+            GABBLE_STRUCT_TYPE_ENHANCED_CONTACT_CAPABILITY));
+
+      fixed_properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
+          (GDestroyNotify) tp_g_value_slice_free);
+
+      channel_type_value = tp_g_value_slice_new (G_TYPE_STRING);
+      g_value_set_static_string (channel_type_value,
+          GABBLE_IFACE_CHANNEL_TYPE_DBUS_TUBE);
+      g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".ChannelType",
+          channel_type_value);
+
+      target_handle_type_value = tp_g_value_slice_new (G_TYPE_UINT);
+      g_value_set_uint (target_handle_type_value, TP_HANDLE_TYPE_CONTACT);
+      g_hash_table_insert (fixed_properties,
+          TP_IFACE_CHANNEL ".TargetHandleType", target_handle_type_value);
+
+      target_handle_type_value = tp_g_value_slice_new (G_TYPE_STRING);
+      g_value_set_string (target_handle_type_value, service);
+      g_hash_table_insert (fixed_properties,
+          GABBLE_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName",
+          target_handle_type_value);
+
+      dbus_g_type_struct_set (&monster,
+          0, handle,
+          1, fixed_properties,
+          2, tube_allowed_properties,
+          G_MAXUINT);
+
+      g_hash_table_destroy (fixed_properties);
+
+      g_ptr_array_add (arr, g_value_get_boxed (&monster));
+    }
 }
 
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list