Skip to content

Commit

Permalink
Added mms_dispatcher_queue_and_unref_task()
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Feb 19, 2014
1 parent 5da1909 commit db2304a
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions mms-lib/src/mms_dispatcher.c
Expand Up @@ -409,17 +409,12 @@ mms_dispatcher_queue_task(
g_queue_push_tail(disp->tasks, mms_task_ref(task));
}

/**
* Creates a WAP push receive task and adds it to the queue.
*/
static
gboolean
mms_dispatcher_handle_push(
mms_dispatcher_queue_and_unref_task(
MMSDispatcher* disp,
const char* imsi,
GBytes* push)
MMSTask* task)
{
MMSTask* task = mms_task_notification_new(disp->config, disp->handler,
imsi, push);
if (task) {
mms_dispatcher_queue_task(disp, task);
mms_task_unref(task);
Expand All @@ -429,6 +424,19 @@ mms_dispatcher_handle_push(
}
}

/**
* Creates a WAP push receive task and adds it to the queue.
*/
gboolean
mms_dispatcher_handle_push(
MMSDispatcher* disp,
const char* imsi,
GBytes* push)
{
return mms_dispatcher_queue_and_unref_task(disp,
mms_task_notification_new(disp->config, disp->handler, imsi, push));
}

/**
* Creates download task and adds it to the queue.
*/
Expand All @@ -445,13 +453,9 @@ mms_dispatcher_receive_message(
if (pdu) {
MMS_ASSERT(pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND);
if (pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND) {
MMSTask* task = mms_task_retrieve_new(disp->config,
disp->handler, id, imsi, pdu);
if (task) {
mms_dispatcher_queue_task(disp, task);
mms_task_unref(task);
ok = TRUE;
}
ok = mms_dispatcher_queue_and_unref_task(disp,
mms_task_retrieve_new(disp->config, disp->handler,
id, imsi, pdu));
}
mms_message_free(pdu);
} else {
Expand All @@ -472,15 +476,9 @@ mms_dispatcher_send_read_report(
const char* to,
MMSReadStatus status)
{
gboolean ok = FALSE;
MMSTask* task = mms_task_read_new(disp->config, disp->handler, id, imsi,
message_id, to, status);
if (task) {
mms_dispatcher_queue_task(disp, task);
mms_task_unref(task);
ok = TRUE;
}
return ok;
return mms_dispatcher_queue_and_unref_task(disp,
mms_task_read_new(disp->config, disp->handler,
id, imsi, message_id, to, status));
}

/**
Expand Down

0 comments on commit db2304a

Please sign in to comment.