[Telepathy-commits] [telepathy-gabble/master] GabbleMediaFactory: don't advertise anonymous channels as requestable

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Nov 5 03:53:06 PST 2008


Spec compliance: RequestableChannelClasses is only meant to contain
channels requestable via CreateChannel/EnsureChannel, which for us
means only channels with TargetHandleType == CONTACT.

Given how many projects cargo-cult code from Gabble, it's good for
our code to be exemplary here.
---
 src/media-factory.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/media-factory.c b/src/media-factory.c
index e579b29..a5b528a 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -846,6 +846,8 @@ static const gchar * const named_channel_allowed_properties[] = {
     NULL
 };
 
+/* not advertised in foreach_channel_class - can only be requested with
+ * RequestChannel, not with CreateChannel/EnsureChannel */
 static const gchar * const anon_channel_allowed_properties[] = {
     NULL
 };
@@ -858,21 +860,16 @@ gabble_media_factory_foreach_channel_class (TpChannelManager *manager,
 {
   GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
       NULL, (GDestroyNotify) tp_g_value_slice_free);
-  GValue *value, *handle_type_value;
+  GValue *value;
 
   value = tp_g_value_slice_new (G_TYPE_STRING);
   g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA);
   g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType", value);
 
-  handle_type_value = tp_g_value_slice_new (G_TYPE_UINT);
-  /* no uint value yet - we'll change it for each channel class */
-  g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
-      handle_type_value);
+  value = tp_g_value_slice_new (G_TYPE_UINT);
+  g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT);
+  g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", value);
 
-  g_value_set_uint (handle_type_value, TP_HANDLE_TYPE_NONE);
-  func (manager, table, anon_channel_allowed_properties, user_data);
-
-  g_value_set_uint (handle_type_value, TP_HANDLE_TYPE_CONTACT);
   func (manager, table, named_channel_allowed_properties, user_data);
 
   g_hash_table_destroy (table);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list