diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-17 20:17:05 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-27 21:20:19 +0800 |
commit | 90d3b83c9a859a02e9439b41c81964acb7d5c070 (patch) | |
tree | 096d9a0dbf2acdedfd5d69726f428139cf23a7f0 | |
parent | a2851c345723360e779b9adc4fe17684136f40b7 (diff) | |
download | gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar.gz gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar.bz2 gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar.lz gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar.xz gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.tar.zst gsoc2013-empathy-90d3b83c9a859a02e9439b41c81964acb7d5c070.zip |
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.
-rw-r--r-- | 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 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 |