]> git.0d.be Git - empathy.git/commitdiff
Merge commit 'sjoerd/master'
authorXavier Claessens <xclaesse@src.gnome.org>
Fri, 15 Feb 2008 22:28:44 +0000 (22:28 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 15 Feb 2008 22:28:44 +0000 (22:28 +0000)
svn path=/trunk/; revision=637

libempathy/empathy-contact.c
libempathy/empathy-contact.h
libempathy/empathy-tp-call.c
libempathy/empathy-tp-contact-factory.c

index 70025c7b0bff54cc59db3ca0ceb323820002f722..3f03c1d3334065e7f1b095ad54d607ff4df574be 100644 (file)
@@ -176,6 +176,10 @@ empathy_contact_class_init (EmpathyContactClass *class)
 static void
 empathy_contact_init (EmpathyContact *contact)
 {
+       EmpathyContactPriv *priv;
+
+       priv = GET_PRIV (contact);
+       priv->capabilities = EMPATHY_CAPABILITIES_UNKNOWN;
 }
 
 static void
index 57a72c9067f070e1103ae38a64690ce3ded6b611..b84f784cc0ecd68faf2e82e4efc2330154de7558 100644 (file)
@@ -54,8 +54,10 @@ struct _EmpathyContactClass {
 };
 
 typedef enum {
+       EMPATHY_CAPABILITIES_NONE = 0,
        EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
        EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
+       EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
 } EmpathyCapabilities;
 
 GType               empathy_contact_get_type           (void) G_GNUC_CONST;
index b72e3877e3cc9de5d46b862e5d47d2e016eef338..4ec4a97ff59043439a9b6291d36d56b94b13bcf8 100644 (file)
@@ -325,6 +325,20 @@ tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
   g_array_free (stream_types, TRUE);
 }
 
+static void
+tp_call_request_streams_capabilities_cb (EmpathyContact *contact,
+  GParamSpec *property, gpointer user_data)
+{
+  EmpathyTpCall *call = EMPATHY_TP_CALL (user_data);
+
+  g_signal_handlers_disconnect_by_func (contact,
+        tp_call_request_streams_capabilities_cb,
+        user_data);
+
+  tp_call_request_streams_for_capabilities (call,
+     empathy_contact_get_capabilities (contact));
+}
+
 static void
 tp_call_request_streams (EmpathyTpCall *call)
 {
@@ -335,7 +349,6 @@ tp_call_request_streams (EmpathyTpCall *call)
   empathy_debug (DEBUG_DOMAIN,
       "Requesting appropriate audio/video streams from contact");
 
-  capabilities = empathy_contact_get_capabilities (priv->contact);
 
   /* FIXME: SIP don't have capabilities interface but we know it supports
    *        only audio and not video. */
@@ -345,6 +358,15 @@ tp_call_request_streams (EmpathyTpCall *call)
     {
       capabilities = EMPATHY_CAPABILITIES_AUDIO;
     }
+  else
+    {
+      capabilities = empathy_contact_get_capabilities (priv->contact);
+      if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN) {
+        g_signal_connect (G_OBJECT (priv->contact), "notify::capabilities",
+          G_CALLBACK (tp_call_request_streams_capabilities_cb), call);
+        return;
+      }
+    }
 
   tp_call_request_streams_for_capabilities (call, capabilities);
 }
index 77482522b35938784f08ddc2a1931d01c837e3b3..533f1c5b19e2448f8f03f4a44b545e7eab01f26a 100644 (file)
@@ -505,8 +505,7 @@ tp_contact_factory_update_capabilities (EmpathyTpContactFactory *tp_factory,
        capabilities = empathy_contact_get_capabilities (contact);
 
        if (strcmp (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA) == 0) {
-               capabilities &= ~EMPATHY_CAPABILITIES_AUDIO;
-               capabilities &= ~EMPATHY_CAPABILITIES_VIDEO;
+               capabilities = EMPATHY_CAPABILITIES_NONE;
                if (specific & TP_CHANNEL_MEDIA_CAPABILITY_AUDIO) {
                        capabilities |= EMPATHY_CAPABILITIES_AUDIO;
                }
@@ -534,7 +533,9 @@ tp_contact_factory_get_capabilities_cb (DBusGProxy *proxy,
 
        if (error) {
                empathy_debug (DEBUG_DOMAIN, "Error getting capabilities: %s",
-                              error->message);
+                      error->message);
+               /* FIXME Should set the capabilities of the contacts for which this request
+                * originated to NONE */
                goto OUT;
        }