Diff between d4d2b1a1dd71865fc1750633efa5a28d16a73c9e and 0e346308d8666708a246bf97c3580e4ef7833c01

Changed Files

File Additions Deletions Status
obexd/client/map.c +31 -0 modified

Full Patch

diff --git a/obexd/client/map.c b/obexd/client/map.c
index a8b12db..20946fe 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1838,6 +1838,25 @@ static void map_handle_new_message(struct map_data *map,
 	map_msg_create(map, event->handle, event->folder, event->msg_type);
 }
 
+static void map_handle_status_changed(struct map_data *map,
+							struct map_event *event,
+							const char *status)
+{
+	struct map_msg *msg = g_hash_table_lookup(map->messages, event->handle);
+
+	if (msg == NULL)
+		return;
+
+	if (g_strcmp0(msg->status, status) == 0)
+		return;
+
+	g_free(msg->status);
+	msg->status = g_strdup(status);
+
+	g_dbus_emit_property_changed(conn, msg->path, MAP_MSG_INTERFACE,
+								"Status");
+}
+
 static void map_handle_notification(struct map_event *event, void *user_data)
 {
 	struct map_data *map = user_data;
@@ -1852,6 +1871,18 @@ static void map_handle_notification(struct map_event *event, void *user_data)
 	case MAP_ET_NEW_MESSAGE:
 		map_handle_new_message(map, event);
 		break;
+	case MAP_ET_DELIVERY_SUCCESS:
+		map_handle_status_changed(map, event, "delivery-success");
+		break;
+	case MAP_ET_SENDING_SUCCESS:
+		map_handle_status_changed(map, event, "sending-success");
+		break;
+	case MAP_ET_DELIVERY_FAILURE:
+		map_handle_status_changed(map, event, "delivery-failure");
+		break;
+	case MAP_ET_SENDING_FAILURE:
+		map_handle_status_changed(map, event, "sending-failure");
+		break;
 	default:
 		break;
 	}