diff options
author | Denis Kenzior <denkenz@gmail.com> | 2013-09-10 10:56:44 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2013-09-12 13:17:39 -0500 |
commit | 394069cb595cb1d9da0afe9ce481356bf6985fda (patch) | |
tree | 993f0814af734a7bf868a949ce16d604db24b459 /src | |
parent | 681bc6d556ebf0c7e663a1863051b838426fdbd5 (diff) | |
download | ofono-394069cb595cb1d9da0afe9ce481356bf6985fda.tar.bz2 |
voicecall: Implement ofono_voicecall_mpty_hint
Diffstat (limited to 'src')
-rw-r--r-- | src/voicecall.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/voicecall.c b/src/voicecall.c index ae76b91f..d11a4cd6 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2355,6 +2355,46 @@ error: g_free(v); } +void ofono_voicecall_mpty_hint(struct ofono_voicecall *vc, unsigned int ids) +{ + GSList *old; + GSList *l; + + DBG("ids: %u", ids); + + /* id of 0 is never valid for a call */ + if (ids & 0x1) + return; + + /* Ignore the hint if there's nothing to do */ + if (__builtin_popcount(ids) < 2 && vc->multiparty_list == NULL) + return; + + old = vc->multiparty_list; + vc->multiparty_list = NULL; + + for (l = vc->call_list; l; l = l->next) { + struct voicecall *v = l->data; + + if (ids & (1 << v->call->id)) + vc->multiparty_list = + g_slist_prepend(vc->multiparty_list, v); + } + + if (vc->multiparty_list) + vc->multiparty_list = g_slist_reverse(vc->multiparty_list); + + if (g_slist_length(vc->multiparty_list) == 1) { + ofono_error("Created multiparty list length is 1" + ", which would indicate a bug in the driver" + " or the remote device"); + vc->multiparty_list = NULL; + } + + voicecalls_multiparty_changed(old, vc->multiparty_list); + g_slist_free(old); +} + static void send_ciev_after_swap_callback(const struct ofono_error *error, void *data) { |