diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-11-13 16:03:33 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-11-13 16:03:33 -0600 |
commit | 27cb260d07d20b7d1e9bd126d667fea61a38a733 (patch) | |
tree | c69265de12485c231ca1eddb530df05d40cb5488 | |
parent | 1a8dd438b22ce5b6c580db3619d2dcbe4a2199e3 (diff) | |
download | ofono-27cb260d07d20b7d1e9bd126d667fea61a38a733.tar.bz2 |
Refactor: Simplify code and add have_incoming
-rw-r--r-- | src/voicecall.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/voicecall.c b/src/voicecall.c index 9107cd09..5fe8a0a9 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -575,7 +575,7 @@ static gboolean voicecalls_can_dtmf(struct ofono_voicecall *vc) return FALSE; } -static gboolean voicecalls_have_held(struct ofono_voicecall *vc) +static gboolean voicecalls_have_with_status(struct ofono_voicecall *vc, int status) { GSList *l; struct voicecall *v; @@ -583,13 +583,18 @@ static gboolean voicecalls_have_held(struct ofono_voicecall *vc) for (l = vc->call_list; l; l = l->next) { v = l->data; - if (v->call->status == CALL_STATUS_HELD) + if (v->call->status == status) return TRUE; } return FALSE; } +static gboolean voicecalls_have_held(struct ofono_voicecall *vc) +{ + return voicecalls_have_with_status(vc, CALL_STATUS_HELD); +} + static int voicecalls_num_with_status(struct ofono_voicecall *vc, int status) { @@ -669,17 +674,12 @@ static GSList *voicecalls_active_list(struct ofono_voicecall *vc) static gboolean voicecalls_have_waiting(struct ofono_voicecall *vc) { - GSList *l; - struct voicecall *v; - - for (l = vc->call_list; l; l = l->next) { - v = l->data; - - if (v->call->status == CALL_STATUS_WAITING) - return TRUE; - } + return voicecalls_have_with_status(vc, CALL_STATUS_WAITING); +} - return FALSE; +static gboolean voicecalls_have_incoming(struct ofono_voicecall *vc) +{ + return voicecalls_have_with_status(vc, CALL_STATUS_INCOMING); } static gboolean real_emit_call_list_changed(void *data) |