[telepathy-gabble/master] gabble_media_factory_foreach_channel_class: factor out gabble_media_factory_channel_class

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 26 09:56:07 PDT 2009


---
 src/media-factory.c |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/media-factory.c b/src/media-factory.c
index b09661b..b9adc60 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -373,6 +373,8 @@ static const gchar * const media_channel_fixed_properties[] = {
     NULL
 };
 
+/* If you change this at all, you'll probably also need to change both_allowed
+ * and video_allowed */
 static const gchar * const named_channel_allowed_properties[] = {
     TP_IFACE_CHANNEL ".TargetHandle",
     TP_IFACE_CHANNEL ".TargetID",
@@ -381,17 +383,24 @@ static const gchar * const named_channel_allowed_properties[] = {
     NULL
 };
 
+static const gchar * const * both_allowed =
+    named_channel_allowed_properties + 2;
+static const gchar * const * video_allowed =
+    named_channel_allowed_properties + 3;
+
+static const gchar * const audio_allowed[] = {
+    GABBLE_IFACE_CHANNEL_TYPE_STREAMED_MEDIA_FUTURE ".InitialAudio",
+    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
 };
 
-
-static void
-gabble_media_factory_foreach_channel_class (TpChannelManager *manager,
-    TpChannelManagerChannelClassFunc func,
-    gpointer user_data)
+static GHashTable *
+gabble_media_factory_channel_class (void)
 {
   GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
       NULL, (GDestroyNotify) tp_g_value_slice_free);
@@ -405,6 +414,16 @@ gabble_media_factory_foreach_channel_class (TpChannelManager *manager,
   g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT);
   g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", value);
 
+  return table;
+}
+
+static void
+gabble_media_factory_foreach_channel_class (TpChannelManager *manager,
+    TpChannelManagerChannelClassFunc func,
+    gpointer user_data)
+{
+  GHashTable *table = gabble_media_factory_channel_class ();
+
   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