diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-08-12 13:13:53 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-08-12 13:13:53 -0500 |
commit | fa2c29c84fedc95946425d3a9f05730eb1bf4068 (patch) | |
tree | bfdabea99829e311ca54fec0a37d2ac2f10e7e92 | |
parent | f65ab1a9da7cf1adfdf2c008abb7e282d04c2916 (diff) | |
download | ofono-fa2c29c84fedc95946425d3a9f05730eb1bf4068.tar.bz2 |
voicecall: Move some stuff around
-rw-r--r-- | src/voicecall.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/voicecall.c b/src/voicecall.c index f07cea69..41976ac9 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -165,6 +165,43 @@ static const char *time_to_str(const time_t *t) return buf; } +static int voicecalls_num_with_status(struct ofono_voicecall *vc, + int status) +{ + GSList *l; + struct voicecall *v; + int num = 0; + + for (l = vc->call_list; l; l = l->next) { + v = l->data; + + if (v->call->status == status) + num += 1; + } + + return num; +} + +static int voicecalls_num_active(struct ofono_voicecall *vc) +{ + return voicecalls_num_with_status(vc, CALL_STATUS_ACTIVE); +} + +static int voicecalls_num_held(struct ofono_voicecall *vc) +{ + return voicecalls_num_with_status(vc, CALL_STATUS_HELD); +} + +static int voicecalls_num_connecting(struct ofono_voicecall *vc) +{ + int r = 0; + + r += voicecalls_num_with_status(vc, CALL_STATUS_DIALING); + r += voicecalls_num_with_status(vc, CALL_STATUS_ALERTING); + + return r; +} + static DBusMessage *voicecall_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -620,43 +657,6 @@ 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) -{ - GSList *l; - struct voicecall *v; - int num = 0; - - for (l = vc->call_list; l; l = l->next) { - v = l->data; - - if (v->call->status == status) - num += 1; - } - - return num; -} - -static int voicecalls_num_active(struct ofono_voicecall *vc) -{ - return voicecalls_num_with_status(vc, CALL_STATUS_ACTIVE); -} - -static int voicecalls_num_held(struct ofono_voicecall *vc) -{ - return voicecalls_num_with_status(vc, CALL_STATUS_HELD); -} - -static int voicecalls_num_connecting(struct ofono_voicecall *vc) -{ - int r = 0; - - r += voicecalls_num_with_status(vc, CALL_STATUS_DIALING); - r += voicecalls_num_with_status(vc, CALL_STATUS_ALERTING); - - return r; -} - static GSList *voicecalls_held_list(struct ofono_voicecall *vc) { GSList *l; |