All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] mmsd: (resending) Support Delivery Report notification
@ 2012-08-24 13:05 Ronald Tessier
  2012-08-24 13:06 ` [PATCH 01/12] mmsutil: Define mms_delivery_ind struct Ronald Tessier
                   ` (11 more replies)
  0 siblings, 12 replies; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]

These patches concern mmsd and add delivery report notification support.
Add MMS M-Delivery.ind PDU decoding support.
Update meta file of the sent message to store the received msg_id and to add a
group [delivery_status] if delivery_report is requested.
Upon MMS M-Delivery.ind PDU reception, update delivery_status recipient entry
with the received status (this is described in doc/storage.txt) and signal the
new delivery_report status for the recipient concerned.
Modify the monitor_mms test script to add report_changed monitoring.
Update message-api.txt doc to describe new ReportChanged signal.

Ronald Tessier (12):
  mmsutil: Define mms_delivery_ind struct
  mmsutil: Decode delivery_ind msg
  service: Store msg_id provided by M-Send.conf PDU
  service: Move mms_address_to_string() up
  service: Add a group [delivery_status] in the msg status
  service: Support M-Delivery.ind in mms_service_push_notify()
  service: Support delivery_ind notif on start
  store: Define MMS_META_UUID_XXX len and suffix
  service: Process delivery_ind notification
  service: Send a delivery changed signal
  test: Add ReportChanged to monitored signals
  doc: Add ReportChanged signal description

 doc/message-api.txt |    7 ++
 src/mmsutil.c       |   22 ++++-
 src/mmsutil.h       |    8 ++
 src/service.c       |  260 ++++++++++++++++++++++++++++++++++++++++++++++-----
 src/store.c         |    8 +-
 src/store.h         |    5 +
 test/monitor-mms    |   10 ++
 7 files changed, 292 insertions(+), 28 deletions(-)

--
1.7.9.5


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 01/12] mmsutil: Define mms_delivery_ind struct
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:41   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 02/12] mmsutil: Decode delivery_ind msg Ronald Tessier
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

---
 src/mmsutil.h |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mmsutil.h b/src/mmsutil.h
index cc3ec67..e32c761 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -122,6 +122,13 @@ struct mms_notification_resp_ind {
 	enum mms_message_notify_status notify_status;
 };
 
+struct mms_delivery_ind {
+	enum mms_message_delivery_status dr_status;
+	char *msgid;
+	char *to;
+	time_t date;
+};
+
 struct mms_attachment {
 	unsigned char *data;
 	size_t offset;
@@ -143,6 +150,7 @@ struct mms_message {
 		struct mms_send_req sr;
 		struct mms_send_conf sc;
 		struct mms_notification_resp_ind nri;
+		struct mms_delivery_ind di;
 	};
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 02/12] mmsutil: Decode delivery_ind msg
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
  2012-08-24 13:06 ` [PATCH 01/12] mmsutil: Define mms_delivery_ind struct Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:41   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU Ronald Tessier
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]

---
 src/mmsutil.c |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index a9a12eb..7042276 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -964,6 +964,24 @@ static gboolean decode_send_req(struct wsp_header_iter *iter,
 	return TRUE;
 }
 
+static gboolean decode_delivery_ind(struct wsp_header_iter *iter,
+						struct mms_message *out)
+{
+	return mms_parse_headers(iter, MMS_HEADER_MMS_VERSION,
+				HEADER_FLAG_MANDATORY | HEADER_FLAG_PRESET_POS,
+				&out->version,
+				MMS_HEADER_MESSAGE_ID,
+				HEADER_FLAG_MANDATORY, &out->di.msgid,
+				MMS_HEADER_TO,
+				HEADER_FLAG_MANDATORY, &out->di.to,
+				MMS_HEADER_DATE,
+				HEADER_FLAG_MANDATORY, &out->di.date,
+				MMS_HEADER_STATUS,
+				HEADER_FLAG_MANDATORY, &out->di.dr_status,
+				MMS_HEADER_INVALID);
+}
+
+
 #define CHECK_WELL_KNOWN_HDR(hdr)			\
 	if (wsp_header_iter_next(&iter) == FALSE)	\
 		return FALSE;				\
@@ -1016,7 +1034,7 @@ gboolean mms_message_decode(const unsigned char *pdu,
 	case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
 		return FALSE;
 	case MMS_MESSAGE_TYPE_DELIVERY_IND:
-		return FALSE;
+		return decode_delivery_ind(&iter, out);
 	}
 
 	return FALSE;
@@ -1051,6 +1069,8 @@ void mms_message_free(struct mms_message *msg)
 	case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
 		break;
 	case MMS_MESSAGE_TYPE_DELIVERY_IND:
+		g_free(msg->di.msgid);
+		g_free(msg->di.to);
 		break;
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
  2012-08-24 13:06 ` [PATCH 01/12] mmsutil: Define mms_delivery_ind struct Ronald Tessier
  2012-08-24 13:06 ` [PATCH 02/12] mmsutil: Decode delivery_ind msg Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:45   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 04/12] service: Move mms_address_to_string() up Ronald Tessier
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

---
 src/service.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index db9c514..b073ca9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -629,7 +629,7 @@ static gboolean result_request_send_conf(struct mms_request *request)
 
 	uuid = request->msg->uuid;
 
-	path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity,	uuid);
+	path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
 	if (request->status != 200)
 		goto error;
@@ -655,17 +655,21 @@ static gboolean result_request_send_conf(struct mms_request *request)
 
 	mms_debug("response status : %d", msg->sc.rsp_status);
 
-	mms_message_free(msg);
-
 	munmap(pdu, len);
 
 	unlink(request->data_path);
 
 	meta = mms_store_meta_open(service->identity, uuid);
-	if (meta == NULL)
+	if (meta == NULL) {
+		mms_message_free(msg);
+
 		goto error;
+	}
 
 	g_key_file_set_string(meta, "info", "state", "sent");
+	g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
+
+	mms_message_free(msg);
 
 	mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 04/12] service: Move mms_address_to_string() up
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (2 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:46   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 05/12] service: Add a group [delivery_status] in the msg status Ronald Tessier
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

---
 src/service.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/service.c b/src/service.c
index b073ca9..c3dc40a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -354,6 +354,19 @@ static gboolean mmap_file(const char *path, void **out_pdu, size_t *out_len)
 	return TRUE;
 }
 
+static const char *mms_address_to_string(char *mms_address)
+{
+	unsigned int prefix_len;
+
+	if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
+		prefix_len = strlen(mms_address) - 10;
+
+		mms_address[prefix_len] = '\0';
+	}
+
+	return (const char *) mms_address;
+}
+
 static gboolean send_message_get_recipients(DBusMessageIter *top_iter,
 						struct mms_message *msg)
 {
@@ -1702,19 +1715,6 @@ static void append_msg_attachments(DBusMessageIter *dict, const char *path,
 	}
 }
 
-static const char *mms_address_to_string(char *mms_address)
-{
-	unsigned int prefix_len;
-
-	if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
-		prefix_len = strlen(mms_address) - 10;
-
-		mms_address[prefix_len] = '\0';
-	}
-
-	return (const char *) mms_address;
-}
-
 static void append_msg_recipients(DBusMessageIter *dict,
 					struct mms_message *msg)
 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 05/12] service: Add a group [delivery_status] in the msg status
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (3 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 04/12] service: Move mms_address_to_string() up Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:50   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify() Ronald Tessier
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

This group contains an entry for each message recipients. Each recipient
entry will be updated when the corresponding report will be received
and then remove the temporary stored delivery report.
---
 src/service.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/service.c b/src/service.c
index c3dc40a..ec1b1b9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -69,6 +69,17 @@ static const char *ctl_chars = "\x01\x02\x03\x04\x05\x06\x07\x08\x0A"
 
 static const char *sep_chars = "()<>@,;:\\\"/[]?={} \t";
 
+static const char *delivery_status[] = {
+	"none",
+	"expired",
+	"retrieved",
+	"rejected",
+	"deferred",
+	"indeterminate",
+	"forwarded",
+	"unreachable"
+};
+
 struct mms_request;
 
 typedef gboolean (*mms_request_result_cb_t) (struct mms_request *request);
@@ -1058,6 +1069,28 @@ static DBusMessage *send_message(DBusConnection *conn,
 
 	g_key_file_set_string(meta, "info", "state", "draft");
 
+	if (service->use_delivery_reports) {
+		char **tos;
+		int i;
+
+		tos = g_strsplit(msg->sr.to, ",", 0);
+
+		for (i = 0; tos[i] != NULL; i++) {
+			char *to = g_strdup(tos[i]);
+
+			mms_address_to_string(to);
+
+			DBG("%s=%s", to, delivery_status[0]);
+
+			g_key_file_set_string(meta, "delivery_status", to,
+							delivery_status[0]);
+
+			g_free(to);
+		}
+
+		g_strfreev(tos);
+	}
+
 	mms_store_meta_close(service->identity, msg->uuid, meta, TRUE);
 
 	if (mms_message_register(service, msg) < 0)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify()
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (4 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 05/12] service: Add a group [delivery_status] in the msg status Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 13:50   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 07/12] service: Support delivery_ind notif on start Ronald Tessier
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

---
 src/service.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/service.c b/src/service.c
index ec1b1b9..8087477 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2325,6 +2325,21 @@ static void process_request_queue(struct mms_service *service)
 						bearer_idle_timeout, service);
 }
 
+static void dump_delivery_ind(struct mms_message *msg)
+{
+	char buf[128];
+
+	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&msg->di.date));
+	buf[127] = '\0';
+
+	mms_info("MMS version: %u.%u\n", (msg->version & 0x70) >> 4,
+						msg->version & 0x0f);
+	mms_info("Msg ID: %s\n", msg->di.msgid);
+	mms_info("To: %s\n", msg->di.to);
+	mms_info("Date: %s\n", buf);
+	mms_info("Delivery Report status: %d\n", msg->di.dr_status);
+}
+
 static void dump_notification_ind(struct mms_message *msg)
 {
 	char buf[128];
@@ -2370,6 +2385,22 @@ void mms_service_push_notify(struct mms_service *service,
 	if (mms_message_decode(data + nread, len - nread, msg) == FALSE)
 		goto error;
 
+	if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+		msg->uuid = g_strdup(uuid);
+
+		dump_delivery_ind(msg);
+
+		meta = mms_store_meta_open(service->identity, uuid);
+		if (meta == NULL)
+			goto error;
+
+		g_key_file_set_string(meta, "info", "state", "notification");
+
+		mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+		return;
+	}
+
 	if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
 		goto error;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 07/12] service: Support delivery_ind notif on start
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (5 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify() Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 14:25   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix Ronald Tessier
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

---
 src/service.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/service.c b/src/service.c
index 8087477..b3ecc1e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1357,7 +1357,8 @@ static gboolean load_message_from_store(const char *service_id,
 	else if (strcmp(state, "draft") == 0
 			&& msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
 		msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
-	else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
+	else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
+			msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
 		goto out;
 
 	success = TRUE;
@@ -1482,6 +1483,8 @@ register_sr:
 			request = NULL;
 			mms_message_register(service, msg);
 		}
+	} else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+		request = NULL;
 	} else
 		request = NULL;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (6 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 07/12] service: Support delivery_ind notif on start Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 14:25   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 09/12] service: Process delivery_ind notification Ronald Tessier
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

---
 src/store.c |    8 +++-----
 src/store.h |    5 +++++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/store.c b/src/store.c
index b09c17b..f1c5714 100644
--- a/src/store.c
+++ b/src/store.c
@@ -42,8 +42,6 @@
 #define TFR
 #endif
 
-#define MMS_SHA1_UUID_LEN 20
-
 static const char *digest_to_str(const unsigned char *digest)
 {
 	static char buf[MMS_SHA1_UUID_LEN * 2 + 1];
@@ -293,7 +291,7 @@ void mms_store_remove(const char *service_id, const char *uuid)
 
 	unlink(pdu_path);
 
-	meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+	meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
 	g_free(pdu_path);
 
@@ -312,7 +310,7 @@ GKeyFile *mms_store_meta_open(const char *service_id, const char *uuid)
 	if (pdu_path == NULL)
 		return NULL;
 
-	meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+	meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
 	g_free(pdu_path);
 
@@ -337,7 +335,7 @@ static void meta_store_sync(const char *service_id, const char *uuid,
 	if (pdu_path == NULL)
 		return;
 
-	meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+	meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
 	g_free(pdu_path);
 
diff --git a/src/store.h b/src/store.h
index ba2c080..fb2ca9f 100644
--- a/src/store.h
+++ b/src/store.h
@@ -19,6 +19,11 @@
  *
  */
 
+#define MMS_SHA1_UUID_LEN 20
+#define MMS_META_UUID_SUFFIX ".status"
+#define MMS_META_UUID_SUFFIX_LEN 7
+#define MMS_META_UUID_LEN (MMS_SHA1_UUID_LEN * 2)
+
 const char *mms_store(const char *service_id, unsigned char *pdu,
 							unsigned int len);
 const char *mms_store_file(const char *service_id, const char *path);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 09/12] service: Process delivery_ind notification
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (7 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 14:26   ` Denis Kenzior
  2012-08-24 13:06 ` [PATCH 10/12] service: Send a delivery changed signal Ronald Tessier
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3825 bytes --]

---
 src/service.c |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 107 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index b3ecc1e..44184cb 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1300,6 +1300,104 @@ static void emit_service_removed(struct mms_service *service)
 				&service->path, DBUS_TYPE_INVALID);
 }
 
+static gboolean get_meta_by_msgid(struct mms_service *service,
+						const char *msgid,
+						char *uuid)
+{
+	GDir *dir;
+	GKeyFile *meta;
+	const char *file;
+	const char *homedir;
+	const char *service_id;
+	char *service_path;
+
+	homedir = g_get_home_dir();
+	if (homedir == NULL)
+		return FALSE;
+
+	service_id = service->identity;
+
+	service_path = g_strdup_printf("%s/.mms/%s/", homedir, service_id);
+
+	dir = g_dir_open(service_path, 0, NULL);
+	g_free(service_path);
+	if (dir == NULL)
+		return FALSE;
+
+	while ((file = g_dir_read_name(dir)) != NULL) {
+		char *id;
+
+		if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
+			continue;
+
+		if (strlen(file) != MMS_META_UUID_LEN +
+						MMS_META_UUID_SUFFIX_LEN)
+			continue;
+
+		strncpy(uuid, file, MMS_META_UUID_LEN);
+		uuid[MMS_META_UUID_LEN] = 0;
+
+		meta = mms_store_meta_open(service_id, uuid);
+		if (meta == NULL)
+			goto bail;
+
+		id = g_key_file_get_string(meta, "info", "id", NULL);
+		if (id == NULL) {
+			mms_store_meta_close(service_id, uuid, meta, FALSE);
+			continue;
+		}
+
+		if (g_strcmp0(msgid, id) == 0) {
+			mms_store_meta_close(service_id, uuid, meta, FALSE);
+			g_dir_close(dir);
+			return TRUE;
+		}
+
+		mms_store_meta_close(service_id, uuid, meta, FALSE);
+	}
+
+bail:
+	g_dir_close(dir);
+
+	return FALSE;
+}
+
+static void process_delivery_ind_notification(struct mms_service *service,
+						struct mms_message *di_msg)
+{
+	GKeyFile *meta;
+	char uuid[MMS_META_UUID_LEN + 1];
+	char *path;
+	char *to;
+
+	if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
+		goto bail;
+
+	meta = mms_store_meta_open(service->identity, uuid);
+	if (meta == NULL)
+		return;
+
+	to = g_strdup(di_msg->di.to);
+
+	mms_address_to_string(to);
+
+	g_key_file_set_string(meta, "delivery_status", to,
+				delivery_status[di_msg->di.dr_status - 127]);
+
+	g_free(to);
+
+	mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+	path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
+
+	g_free(path);
+
+bail:
+	mms_store_remove(service->identity, di_msg->uuid);
+
+	mms_message_free(di_msg);
+}
+
 static gboolean load_message_from_store(const char *service_id,
 				const char *uuid, struct mms_message *msg)
 {
@@ -1485,6 +1583,7 @@ register_sr:
 		}
 	} else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
 		request = NULL;
+		process_delivery_ind_notification(service, msg);
 	} else
 		request = NULL;
 
@@ -1514,15 +1613,17 @@ static void load_messages(struct mms_service *service)
 		return;
 
 	while ((file = g_dir_read_name(dir)) != NULL) {
-		const size_t suffix_len = 7;
 		char *uuid;
+		size_t uuid_len;
 
-		if (g_str_has_suffix(file, ".status") == FALSE)
+		if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
 			continue;
-		if (strlen(file) - suffix_len == 0)
+
+		uuid_len = strlen(file) - MMS_META_UUID_SUFFIX_LEN;
+		if (uuid_len == 0)
 			continue;
 
-		uuid = g_strndup(file, strlen(file) - suffix_len);
+		uuid = g_strndup(file, uuid_len);
 
 		process_message_on_start(service, uuid);
 
@@ -2401,6 +2502,8 @@ void mms_service_push_notify(struct mms_service *service,
 
 		mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
+		process_delivery_ind_notification(service, msg);
+
 		return;
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 10/12] service: Send a delivery changed signal
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (8 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 09/12] service: Process delivery_ind notification Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-24 13:06 ` [PATCH 11/12] test: Add ReportChanged to monitored signals Ronald Tessier
  2012-08-24 13:06 ` [PATCH 12/12] doc: Add ReportChanged signal description Ronald Tessier
  11 siblings, 0 replies; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2801 bytes --]

---
 src/service.c |   48 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 44184cb..ba23b4a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -218,6 +218,40 @@ static void emit_msg_status_changed(const char *path, const char *new_status)
 	g_dbus_send_message(connection, signal);
 }
 
+static void emit_msg_delivery_changed(const char *path, const char *rec,
+							const char *status)
+{
+	DBusMessage *signal;
+	DBusMessageIter iter;
+	DBusMessageIter variant;
+	const char *type = "delivery_report";
+
+	signal = dbus_message_new_signal(path, MMS_MESSAGE_INTERFACE,
+							"ReportChanged");
+	if (signal == NULL)
+		return;
+
+	dbus_message_iter_init_append(signal, &iter);
+
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &type);
+
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+					DBUS_TYPE_STRING_AS_STRING, &variant);
+
+	dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &rec);
+
+	dbus_message_iter_close_container(&iter, &variant);
+
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+					DBUS_TYPE_STRING_AS_STRING, &variant);
+
+	dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &status);
+
+	dbus_message_iter_close_container(&iter, &variant);
+
+	g_dbus_send_message(connection, signal);
+}
+
 static DBusMessage *msg_mark_read(DBusConnection *conn,
 					DBusMessage *msg, void *user_data)
 {
@@ -269,6 +303,10 @@ static const GDBusMethodTable message_methods[] = {
 static const GDBusSignalTable message_signals[] = {
 	{ GDBUS_SIGNAL("PropertyChanged",
 			GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+	{ GDBUS_SIGNAL("ReportChanged",
+			GDBUS_ARGS({ "name", "s" },
+					{ "rec", "v" },
+					{ "status", "v" })) },
 	{ }
 };
 
@@ -1369,6 +1407,7 @@ static void process_delivery_ind_notification(struct mms_service *service,
 	char uuid[MMS_META_UUID_LEN + 1];
 	char *path;
 	char *to;
+	const char *new_status;
 
 	if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
 		goto bail;
@@ -1381,15 +1420,18 @@ static void process_delivery_ind_notification(struct mms_service *service,
 
 	mms_address_to_string(to);
 
-	g_key_file_set_string(meta, "delivery_status", to,
-				delivery_status[di_msg->di.dr_status - 127]);
+	new_status = delivery_status[di_msg->di.dr_status - 127];
 
-	g_free(to);
+	g_key_file_set_string(meta, "delivery_status", to, new_status);
 
 	mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
 	path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
+	emit_msg_delivery_changed(path, to, new_status);
+
+	g_free(to);
+
 	g_free(path);
 
 bail:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 11/12] test: Add ReportChanged to monitored signals
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (9 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 10/12] service: Send a delivery changed signal Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-24 13:06 ` [PATCH 12/12] doc: Add ReportChanged signal description Ronald Tessier
  11 siblings, 0 replies; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]

---
 test/monitor-mms |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/monitor-mms b/test/monitor-mms
index 188d028..ef17a13 100755
--- a/test/monitor-mms
+++ b/test/monitor-mms
@@ -29,6 +29,10 @@ def property_changed(name, value, member, path, interface):
 	iface = interface[interface.rfind(".") + 1:]
 	print "{%s} [%s] %s %s" % (iface, name, member, value)
 
+def report_changed(type, rec, status, path, interface):
+	iface = interface[interface.rfind(".") + 1:]
+	print "{%s} [%s] <%s> %s : %s" % (iface, path, type, rec, status)
+
 if __name__ == '__main__':
 	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
@@ -75,5 +79,11 @@ if __name__ == '__main__':
 						path_keyword="path",
 						interface_keyword="interface")
 
+	bus.add_signal_receiver(report_changed,
+					bus_name="org.ofono.mms",
+					signal_name = "ReportChanged",
+						path_keyword="path",
+						interface_keyword="interface")
+
 	mainloop = gobject.MainLoop()
 	mainloop.run()
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 12/12] doc: Add ReportChanged signal description
  2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
                   ` (10 preceding siblings ...)
  2012-08-24 13:06 ` [PATCH 11/12] test: Add ReportChanged to monitored signals Ronald Tessier
@ 2012-08-24 13:06 ` Ronald Tessier
  2012-08-28 14:29   ` Denis Kenzior
  11 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-08-24 13:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

---
 doc/message-api.txt |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/message-api.txt b/doc/message-api.txt
index 2922e5d..274bb98 100644
--- a/doc/message-api.txt
+++ b/doc/message-api.txt
@@ -31,6 +31,13 @@ Signals		PropertyChanged(string name, variant value)
 			The only expected property change is for the
 			message status.
 
+		ReportChanged(string type, variant recipient, variant status)
+
+			Signal that is sent when a report has been received and
+			processed. It contains the type of the report
+			("delivery_report" or other), the recipient concerned
+			and its new status.
+
 Properties	string Status [readonly]
 
 			The status of the message.  Possible values are
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 02/12] mmsutil: Decode delivery_ind msg
  2012-08-24 13:06 ` [PATCH 02/12] mmsutil: Decode delivery_ind msg Ronald Tessier
@ 2012-08-28 13:41   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:41 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/mmsutil.c |   22 +++++++++++++++++++++-
>   1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/src/mmsutil.c b/src/mmsutil.c
> index a9a12eb..7042276 100644
> --- a/src/mmsutil.c
> +++ b/src/mmsutil.c
> @@ -964,6 +964,24 @@ static gboolean decode_send_req(struct wsp_header_iter *iter,
>   	return TRUE;
>   }
>
> +static gboolean decode_delivery_ind(struct wsp_header_iter *iter,
> +						struct mms_message *out)
> +{
> +	return mms_parse_headers(iter, MMS_HEADER_MMS_VERSION,
> +				HEADER_FLAG_MANDATORY | HEADER_FLAG_PRESET_POS,
> +				&out->version,
> +				MMS_HEADER_MESSAGE_ID,
> +				HEADER_FLAG_MANDATORY,&out->di.msgid,
> +				MMS_HEADER_TO,
> +				HEADER_FLAG_MANDATORY,&out->di.to,
> +				MMS_HEADER_DATE,
> +				HEADER_FLAG_MANDATORY,&out->di.date,
> +				MMS_HEADER_STATUS,
> +				HEADER_FLAG_MANDATORY,&out->di.dr_status,
> +				MMS_HEADER_INVALID);
> +}
> +
> +

Why the double empty line?

>   #define CHECK_WELL_KNOWN_HDR(hdr)			\
>   	if (wsp_header_iter_next(&iter) == FALSE)	\
>   		return FALSE;				\
> @@ -1016,7 +1034,7 @@ gboolean mms_message_decode(const unsigned char *pdu,
>   	case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
>   		return FALSE;
>   	case MMS_MESSAGE_TYPE_DELIVERY_IND:
> -		return FALSE;
> +		return decode_delivery_ind(&iter, out);
>   	}
>
>   	return FALSE;
> @@ -1051,6 +1069,8 @@ void mms_message_free(struct mms_message *msg)
>   	case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
>   		break;
>   	case MMS_MESSAGE_TYPE_DELIVERY_IND:
> +		g_free(msg->di.msgid);
> +		g_free(msg->di.to);
>   		break;
>   	}
>

Regards,
-Denis

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 01/12] mmsutil: Define mms_delivery_ind struct
  2012-08-24 13:06 ` [PATCH 01/12] mmsutil: Define mms_delivery_ind struct Ronald Tessier
@ 2012-08-28 13:41   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:41 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/mmsutil.h |    8 ++++++++
>   1 file changed, 8 insertions(+)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU
  2012-08-24 13:06 ` [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU Ronald Tessier
@ 2012-08-28 13:45   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:45 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/service.c |   12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 04/12] service: Move mms_address_to_string() up
  2012-08-24 13:06 ` [PATCH 04/12] service: Move mms_address_to_string() up Ronald Tessier
@ 2012-08-28 13:46   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/service.c |   26 +++++++++++++-------------
>   1 file changed, 13 insertions(+), 13 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 05/12] service: Add a group [delivery_status] in the msg status
  2012-08-24 13:06 ` [PATCH 05/12] service: Add a group [delivery_status] in the msg status Ronald Tessier
@ 2012-08-28 13:50   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:50 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> This group contains an entry for each message recipients. Each recipient
> entry will be updated when the corresponding report will be received
> and then remove the temporary stored delivery report.
> ---
>   src/service.c |   33 +++++++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify()
  2012-08-24 13:06 ` [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify() Ronald Tessier
@ 2012-08-28 13:50   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 13:50 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/service.c |   31 +++++++++++++++++++++++++++++++
>   1 file changed, 31 insertions(+)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 07/12] service: Support delivery_ind notif on start
  2012-08-24 13:06 ` [PATCH 07/12] service: Support delivery_ind notif on start Ronald Tessier
@ 2012-08-28 14:25   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 14:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/service.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix
  2012-08-24 13:06 ` [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix Ronald Tessier
@ 2012-08-28 14:25   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 14:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/store.c |    8 +++-----
>   src/store.h |    5 +++++
>   2 files changed, 8 insertions(+), 5 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 09/12] service: Process delivery_ind notification
  2012-08-24 13:06 ` [PATCH 09/12] service: Process delivery_ind notification Ronald Tessier
@ 2012-08-28 14:26   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 14:26 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 4290 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   src/service.c |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 107 insertions(+), 4 deletions(-)
>
> diff --git a/src/service.c b/src/service.c
> index b3ecc1e..44184cb 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -1300,6 +1300,104 @@ static void emit_service_removed(struct mms_service *service)
>   				&service->path, DBUS_TYPE_INVALID);
>   }
>
> +static gboolean get_meta_by_msgid(struct mms_service *service,
> +						const char *msgid,
> +						char *uuid)
> +{
> +	GDir *dir;
> +	GKeyFile *meta;
> +	const char *file;
> +	const char *homedir;
> +	const char *service_id;
> +	char *service_path;
> +
> +	homedir = g_get_home_dir();
> +	if (homedir == NULL)
> +		return FALSE;
> +
> +	service_id = service->identity;
> +
> +	service_path = g_strdup_printf("%s/.mms/%s/", homedir, service_id);
> +
> +	dir = g_dir_open(service_path, 0, NULL);
> +	g_free(service_path);
> +	if (dir == NULL)
> +		return FALSE;
> +
> +	while ((file = g_dir_read_name(dir)) != NULL) {
> +		char *id;
> +
> +		if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
> +			continue;
> +
> +		if (strlen(file) != MMS_META_UUID_LEN +
> +						MMS_META_UUID_SUFFIX_LEN)
> +			continue;
> +
> +		strncpy(uuid, file, MMS_META_UUID_LEN);
> +		uuid[MMS_META_UUID_LEN] = 0;
> +
> +		meta = mms_store_meta_open(service_id, uuid);
> +		if (meta == NULL)
> +			goto bail;
> +
> +		id = g_key_file_get_string(meta, "info", "id", NULL);
> +		if (id == NULL) {
> +			mms_store_meta_close(service_id, uuid, meta, FALSE);
> +			continue;
> +		}
> +
> +		if (g_strcmp0(msgid, id) == 0) {
> +			mms_store_meta_close(service_id, uuid, meta, FALSE);
> +			g_dir_close(dir);
> +			return TRUE;
> +		}
> +
> +		mms_store_meta_close(service_id, uuid, meta, FALSE);
> +	}
> +
> +bail:
> +	g_dir_close(dir);
> +
> +	return FALSE;
> +}
> +
> +static void process_delivery_ind_notification(struct mms_service *service,
> +						struct mms_message *di_msg)
> +{
> +	GKeyFile *meta;
> +	char uuid[MMS_META_UUID_LEN + 1];
> +	char *path;
> +	char *to;
> +
> +	if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
> +		goto bail;
> +
> +	meta = mms_store_meta_open(service->identity, uuid);
> +	if (meta == NULL)
> +		return;
> +
> +	to = g_strdup(di_msg->di.to);
> +
> +	mms_address_to_string(to);
> +
> +	g_key_file_set_string(meta, "delivery_status", to,
> +				delivery_status[di_msg->di.dr_status - 127]);
> +
> +	g_free(to);
> +
> +	mms_store_meta_close(service->identity, uuid, meta, TRUE);
> +
> +	path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
> +
> +	g_free(path);
> +
> +bail:
> +	mms_store_remove(service->identity, di_msg->uuid);
> +
> +	mms_message_free(di_msg);
> +}
> +
>   static gboolean load_message_from_store(const char *service_id,
>   				const char *uuid, struct mms_message *msg)
>   {
> @@ -1485,6 +1583,7 @@ register_sr:
>   		}
>   	} else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
>   		request = NULL;
> +		process_delivery_ind_notification(service, msg);
>   	} else
>   		request = NULL;
>
> @@ -1514,15 +1613,17 @@ static void load_messages(struct mms_service *service)
>   		return;
>
>   	while ((file = g_dir_read_name(dir)) != NULL) {
> -		const size_t suffix_len = 7;
>   		char *uuid;
> +		size_t uuid_len;
>
> -		if (g_str_has_suffix(file, ".status") == FALSE)
> +		if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
>   			continue;
> -		if (strlen(file) - suffix_len == 0)
> +
> +		uuid_len = strlen(file) - MMS_META_UUID_SUFFIX_LEN;
> +		if (uuid_len == 0)
>   			continue;
>
> -		uuid = g_strndup(file, strlen(file) - suffix_len);
> +		uuid = g_strndup(file, uuid_len);
>
>   		process_message_on_start(service, uuid);
>

This chunk should really be in a separate patch since it is related to 
the previous one.

> @@ -2401,6 +2502,8 @@ void mms_service_push_notify(struct mms_service *service,
>
>   		mms_store_meta_close(service->identity, uuid, meta, TRUE);
>
> +		process_delivery_ind_notification(service, msg);
> +
>   		return;
>   	}
>

Regards,
-Denis

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 12/12] doc: Add ReportChanged signal description
  2012-08-24 13:06 ` [PATCH 12/12] doc: Add ReportChanged signal description Ronald Tessier
@ 2012-08-28 14:29   ` Denis Kenzior
  2012-09-04 15:26     ` Ronald Tessier
  0 siblings, 1 reply; 26+ messages in thread
From: Denis Kenzior @ 2012-08-28 14:29 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

Hi Ronald,

On 08/24/2012 08:06 AM, Ronald Tessier wrote:
> ---
>   doc/message-api.txt |    7 +++++++
>   1 file changed, 7 insertions(+)
>

Please order any D-Bus API changes before the D-Bus API implementations. 
  E.g. this patch should be #10 in your series.

> diff --git a/doc/message-api.txt b/doc/message-api.txt
> index 2922e5d..274bb98 100644
> --- a/doc/message-api.txt
> +++ b/doc/message-api.txt
> @@ -31,6 +31,13 @@ Signals		PropertyChanged(string name, variant value)
>   			The only expected property change is for the
>   			message status.
>
> +		ReportChanged(string type, variant recipient, variant status)
> +
> +			Signal that is sent when a report has been received and
> +			processed. It contains the type of the report
> +			("delivery_report" or other), the recipient concerned
> +			and its new status.
> +

Why are we not simply changing the 'Status' to delivered/expired, etc?

>   Properties	string Status [readonly]
>
>   			The status of the message.  Possible values are

Regards,
-Denis

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 12/12] doc: Add ReportChanged signal description
  2012-08-28 14:29   ` Denis Kenzior
@ 2012-09-04 15:26     ` Ronald Tessier
  2012-09-04 19:20       ` Denis Kenzior
  0 siblings, 1 reply; 26+ messages in thread
From: Ronald Tessier @ 2012-09-04 15:26 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

Hi Denis,

On 08/28/2012 04:29 PM, Denis Kenzior wrote:
> Hi Ronald,
>
> On 08/24/2012 08:06 AM, Ronald Tessier wrote:
>> ---
>>   doc/message-api.txt |    7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>
> Please order any D-Bus API changes before the D-Bus API implementations.
>   E.g. this patch should be #10 in your series.
>
>> diff --git a/doc/message-api.txt b/doc/message-api.txt
>> index 2922e5d..274bb98 100644
>> --- a/doc/message-api.txt
>> +++ b/doc/message-api.txt
>> @@ -31,6 +31,13 @@ Signals        PropertyChanged(string name, variant
>> value)
>>               The only expected property change is for the
>>               message status.
>>
>> +        ReportChanged(string type, variant recipient, variant status)
>> +
>> +            Signal that is sent when a report has been received and
>> +            processed. It contains the type of the report
>> +            ("delivery_report" or other), the recipient concerned
>> +            and its new status.
>> +
>
> Why are we not simply changing the 'Status' to delivered/expired, etc?

Unfortunately, we cannot use the message status because there is one 
delivery status per recipient (a message can be sent to 2 (or more) 
recipients, so it can be delivered to one of them and "not yet 
delivered" to the other one).

Regards,

Ronald


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 12/12] doc: Add ReportChanged signal description
  2012-09-04 15:26     ` Ronald Tessier
@ 2012-09-04 19:20       ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2012-09-04 19:20 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

Hi Ronald,

>>> + ReportChanged(string type, variant recipient, variant status)
>>> +
>>> + Signal that is sent when a report has been received and
>>> + processed. It contains the type of the report
>>> + ("delivery_report" or other), the recipient concerned
>>> + and its new status.
>>> +
>>
>> Why are we not simply changing the 'Status' to delivered/expired, etc?
>
> Unfortunately, we cannot use the message status because there is one
> delivery status per recipient (a message can be sent to 2 (or more)
> recipients, so it can be delivered to one of them and "not yet
> delivered" to the other one).
>

So how do you expect this to work? Is the application responsible for 
aggregating the recipients?  If so, then that is not a good idea, mmsd 
should be doing as much work as possible here.

Can't we use delivered/partially_delivered/expired and provide exact 
status details as a dictionary?

Regards,
-Denis

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 04/12] service: Move mms_address_to_string() up
  2012-08-17 14:35 [PATCH 00/12] mmsd: Support Delivery Report notification Ronald Tessier
@ 2012-08-17 14:35 ` Ronald Tessier
  0 siblings, 0 replies; 26+ messages in thread
From: Ronald Tessier @ 2012-08-17 14:35 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

---
 src/service.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/service.c b/src/service.c
index b073ca9..c3dc40a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -354,6 +354,19 @@ static gboolean mmap_file(const char *path, void **out_pdu, size_t *out_len)
 	return TRUE;
 }
 
+static const char *mms_address_to_string(char *mms_address)
+{
+	unsigned int prefix_len;
+
+	if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
+		prefix_len = strlen(mms_address) - 10;
+
+		mms_address[prefix_len] = '\0';
+	}
+
+	return (const char *) mms_address;
+}
+
 static gboolean send_message_get_recipients(DBusMessageIter *top_iter,
 						struct mms_message *msg)
 {
@@ -1702,19 +1715,6 @@ static void append_msg_attachments(DBusMessageIter *dict, const char *path,
 	}
 }
 
-static const char *mms_address_to_string(char *mms_address)
-{
-	unsigned int prefix_len;
-
-	if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
-		prefix_len = strlen(mms_address) - 10;
-
-		mms_address[prefix_len] = '\0';
-	}
-
-	return (const char *) mms_address;
-}
-
 static void append_msg_recipients(DBusMessageIter *dict,
 					struct mms_message *msg)
 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2012-09-04 19:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24 13:05 [PATCH 00/12] mmsd: (resending) Support Delivery Report notification Ronald Tessier
2012-08-24 13:06 ` [PATCH 01/12] mmsutil: Define mms_delivery_ind struct Ronald Tessier
2012-08-28 13:41   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 02/12] mmsutil: Decode delivery_ind msg Ronald Tessier
2012-08-28 13:41   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU Ronald Tessier
2012-08-28 13:45   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 04/12] service: Move mms_address_to_string() up Ronald Tessier
2012-08-28 13:46   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 05/12] service: Add a group [delivery_status] in the msg status Ronald Tessier
2012-08-28 13:50   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify() Ronald Tessier
2012-08-28 13:50   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 07/12] service: Support delivery_ind notif on start Ronald Tessier
2012-08-28 14:25   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix Ronald Tessier
2012-08-28 14:25   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 09/12] service: Process delivery_ind notification Ronald Tessier
2012-08-28 14:26   ` Denis Kenzior
2012-08-24 13:06 ` [PATCH 10/12] service: Send a delivery changed signal Ronald Tessier
2012-08-24 13:06 ` [PATCH 11/12] test: Add ReportChanged to monitored signals Ronald Tessier
2012-08-24 13:06 ` [PATCH 12/12] doc: Add ReportChanged signal description Ronald Tessier
2012-08-28 14:29   ` Denis Kenzior
2012-09-04 15:26     ` Ronald Tessier
2012-09-04 19:20       ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2012-08-17 14:35 [PATCH 00/12] mmsd: Support Delivery Report notification Ronald Tessier
2012-08-17 14:35 ` [PATCH 04/12] service: Move mms_address_to_string() up Ronald Tessier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.