]> git.0d.be Git - empathy.git/commitdiff
Use ContactCapabilities to get audio/video caps (#599163)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 13 Jan 2010 15:17:01 +0000 (15:17 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 14 Jan 2010 12:59:29 +0000 (12:59 +0000)
libempathy/empathy-tp-contact-factory.c

index b8be403c681afbcc5f624ae7e2ab45d08982e0e0..ac5a7f2c46cbec75ef5831b66c98d231a3f6a344 100644 (file)
@@ -755,11 +755,13 @@ update_contact_capabilities (EmpathyTpContactFactory *self,
                for (i = 0; i < classes->len; i++) {
                        GValueArray *class_struct;
                        GHashTable *fixed_prop;
+                       GStrv allowed_prop;
                        TpHandleType handle_type;
                        const gchar *chan_type;
 
                        class_struct = g_ptr_array_index (classes, i);
                        fixed_prop = g_value_get_boxed (g_value_array_get_nth (class_struct, 0));
+                       allowed_prop = g_value_get_boxed (g_value_array_get_nth (class_struct, 1));
 
                        handle_type = tp_asv_get_uint32 (fixed_prop,
                                TP_IFACE_CHANNEL ".TargetHandleType", NULL);
@@ -772,8 +774,21 @@ update_contact_capabilities (EmpathyTpContactFactory *self,
                        if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER))
                                capabilities |= EMPATHY_CAPABILITIES_FT;
 
-                       if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE))
+                       if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) {
                                capabilities |= EMPATHY_CAPABILITIES_STREAM_TUBE;
+                       }
+                       else if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)) {
+                               guint j;
+
+                               for (j = 0; allowed_prop[j] != NULL; j++) {
+                                       if (!tp_strdiff (allowed_prop[j],
+                                                       TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA ".InitialAudio"))
+                                               capabilities |= EMPATHY_CAPABILITIES_AUDIO;
+                                       else if (!tp_strdiff (allowed_prop[j],
+                                                       TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA ".InitialVideo"))
+                                               capabilities |= EMPATHY_CAPABILITIES_VIDEO;
+                               }
+                       }
                }
 
                DEBUG ("Changing capabilities for contact %s (%d) to %d",