[empathy] voip_cmp_func: first check if we support and then audio



commit 90d3b83c9a859a02e9439b41c81964acb7d5c070
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Sep 17 14:17:05 2010 +0200

    voip_cmp_func: first check if we support and then audio
    
    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 |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 642f087..6eaa8c3 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]