summaryrefslogtreecommitdiffstats
path: root/src/voicecall.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-10-12 16:14:06 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-10-12 16:14:06 -0500
commitf5d84faf2299607cc54868940a27081a28f54c43 (patch)
tree4e5abd935153c65c220864c585ebdd996bb0db10 /src/voicecall.c
parent4ced8116a9a6ea0a4b95702bd2ca863dd3396f58 (diff)
downloadofono-f5d84faf2299607cc54868940a27081a28f54c43.tar.bz2
voicecall: Make emulator use release_queue
Diffstat (limited to 'src/voicecall.c')
-rw-r--r--src/voicecall.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/voicecall.c b/src/voicecall.c
index 17d42b3a..088bc577 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -1220,7 +1220,8 @@ static void voicecalls_emit_call_added(struct ofono_voicecall *vc,
}
static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls,
- ofono_voicecall_cb_t cb)
+ ofono_voicecall_cb_t cb,
+ ofono_bool_t skip_held)
{
GSList *l;
struct voicecall *call;
@@ -1234,6 +1235,9 @@ static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls,
if (call->call->status == CALL_STATUS_WAITING)
continue;
+ if (skip_held && call->call->status == CALL_STATUS_HELD)
+ continue;
+
vc->release_list = g_slist_prepend(vc->release_list, l->data);
}
@@ -1957,7 +1961,7 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
/* Fall back to the old-fashioned way */
voicecalls_release_queue(vc, vc->multiparty_list,
- voicecalls_release_done);
+ voicecalls_release_done, FALSE);
voicecalls_release_next(vc);
out:
@@ -2316,7 +2320,8 @@ static void hangup_all_active(const struct ofono_error *error, void *data)
voicecalls_have_waiting(vc)) {
GSList *held = voicecalls_held_list(vc);
- voicecalls_release_queue(vc, held, voicecalls_release_done);
+ voicecalls_release_queue(vc, held,
+ voicecalls_release_done, FALSE);
voicecalls_release_next(vc);
g_slist_free(held);
@@ -2905,8 +2910,6 @@ static void emulator_chup_cb(struct ofono_emulator *em,
{
struct ofono_voicecall *vc = userdata;
struct ofono_error result;
- GSList *l;
- struct voicecall *call;
result.error = 0;
@@ -2928,22 +2931,12 @@ static void emulator_chup_cb(struct ofono_emulator *em,
goto done;
}
- for (l = vc->call_list; l; l = l->next) {
- call = l->data;
-
- if (call->call->status == CALL_STATUS_WAITING ||
- call->call->status == CALL_STATUS_HELD)
- continue;
-
- vc->release_list = g_slist_prepend(vc->release_list,
- l->data);
- }
-
- if (vc->release_list == NULL)
+ if (voicecalls_have_active(vc) == FALSE)
goto fail;
vc->pending_em = em;
- vc->release_queue_done_cb = emulator_generic_cb;
+ voicecalls_release_queue(vc, vc->call_list,
+ emulator_generic_cb, TRUE);
voicecalls_release_next(vc);
done: