]> git.0d.be Git - empathy.git/commitdiff
voip_cmp_func: first check if we support and then audio
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 17 Sep 2010 12:17:05 +0000 (14:17 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 27 Sep 2010 13:20:19 +0000 (15:20 +0200)
This doesn't change anything when doing audio/video calls as we know for sure
that the individials support the capabilities. But when doing chat, we first
want to use the individial supporting video and then audio in case of a tie.

libempathy/empathy-contact.c

index 642f087df0971ca1052f70d005209bc724e22003..6eaa8c3cd0ffe6c7f35b13c84134a56cb30613e2 100644 (file)
@@ -1755,19 +1755,29 @@ static gint
 voip_cmp_func (EmpathyContact *a,
     EmpathyContact *b)
 {
-  gboolean has_audio_video_a, has_audio_video_b;
+  gboolean has_audio_a, has_audio_b;
+  gboolean has_video_a, has_video_b;
 
-  has_audio_video_a = empathy_contact_can_voip_audio (a) &&
-      empathy_contact_can_voip_video (a);
-  has_audio_video_b = empathy_contact_can_voip_audio (b) &&
-      empathy_contact_can_voip_video (b);
+  has_audio_a = empathy_contact_can_voip_audio (a);
+  has_audio_b = empathy_contact_can_voip_audio (b);
+  has_video_a = empathy_contact_can_voip_video (a);
+  has_video_b = empathy_contact_can_voip_video (b);
 
-  if (has_audio_video_a && !has_audio_video_b)
+  /* First check video */
+  if (has_video_a == has_video_b)
+    {
+      /* Use audio to to break tie */
+      if (has_audio_a == has_audio_b)
+        return 0;
+      else if (has_audio_a)
+        return -1;
+      else
+        return 1;
+    }
+  else if (has_video_a)
     return -1;
-  else if (!has_audio_video_a && has_audio_video_b)
-    return 1;
   else
-    return 0;
+    return 1;
 }
 
 static gint