From 90d3b83c9a859a02e9439b41c81964acb7d5c070 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 17 Sep 2010 14:17:05 +0200 Subject: 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 file changed, 19 insertions(+), 9 deletions(-) (limited to 'libempathy/empathy-contact.c') diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 642f087df..6eaa8c3cd 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 -- cgit v1.2.3