Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mms-handler] Pass MMS location URL to the handler. Fixes JB#18573
It allows the handler to ignore duplicate push notifications.
  • Loading branch information
monich committed Jan 27, 2017
1 parent eeade0d commit ee9f12c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
6 changes: 6 additions & 0 deletions mms-handler-dbus/spec/org.nemomobile.MmsHandler.xml
Expand Up @@ -56,6 +56,12 @@
<arg type="ay" name="data" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
<!--
Message download URL. This URL should uniquely identify
the message. It can be used to detect and drop duplicate
notifications.
-->
<arg direction="in" type="s" name="location"/>
<!--
Database record id for immediate retrieval, empty for manual.
-->
Expand Down
5 changes: 3 additions & 2 deletions mms-handler-dbus/src/mms_handler_dbus.c
Expand Up @@ -201,6 +201,7 @@ mms_handler_dbus_message_notify(
const char* subject,
time_t expiry,
GBytes* push,
const char* location,
mms_handler_message_notify_complete_fn cb,
void* param)
{
Expand All @@ -215,8 +216,8 @@ mms_handler_dbus_message_notify(

mms_handler_busy_inc(handler);
call = mms_handler_notify_call_create(dbus, cb, param);
org_nemomobile_mms_handler_call_message_notification(
proxy, imsi, from, subject, expiry, bytes, call->cancellable,
org_nemomobile_mms_handler_call_message_notification(proxy, imsi,
from, subject, expiry, bytes, location, call->cancellable,
mms_handler_dbus_message_notify_done, call);

g_variant_unref(bytes);
Expand Down
5 changes: 3 additions & 2 deletions mms-lib/include/mms_handler.h
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2015 Jolla Ltd.
* Copyright (C) 2013-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -10,7 +10,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/

#ifndef JOLLA_MMS_HANDLER_H
Expand Down Expand Up @@ -112,6 +111,7 @@ typedef struct mms_handler_class {
const char* subject, /* Subject (optional) */
time_t expiry, /* Message expiry time */
GBytes* push, /* Raw push message */
const char* location, /* Download URL */
mms_handler_message_notify_complete_fn cb,
void* param);

Expand Down Expand Up @@ -192,6 +192,7 @@ mms_handler_message_notify(
const char* subject, /* Subject (optional) */
time_t expiry, /* Message expiry time */
GBytes* push, /* Raw push message */
const char* location, /* Download URL */
mms_handler_message_notify_complete_fn cb,
void* param);

Expand Down
5 changes: 3 additions & 2 deletions mms-lib/src/mms_handler.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Copyright (C) 2013-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -119,6 +119,7 @@ mms_handler_message_notify(
const char* subject,
time_t expiry,
GBytes* push,
const char* location,
mms_handler_message_notify_complete_fn cb,
void* param)
{
Expand All @@ -128,7 +129,7 @@ mms_handler_message_notify(
if (!from) from = "";
if (!subject) subject = "";
return klass->fn_message_notify(h, imsi, from, subject, expiry,
push, cb, param);
push, location, cb, param);
}
}
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions mms-lib/src/mms_task_notification.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Copyright (C) 2013-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -168,7 +168,7 @@ mms_task_notification_ind(
mms_task_ref(task);
ind->notify = mms_handler_message_notify(task->handler, task->imsi,
mms_strip_address_type(ni->from), ni->subject, ni->expiry,
ind->push, mms_task_notification_done, ind);
ind->push, ni->location, mms_task_notification_done, ind);

if (ind->notify) {
mms_task_set_state(task, MMS_TASK_STATE_PENDING);
Expand Down

0 comments on commit ee9f12c

Please sign in to comment.