summaryrefslogtreecommitdiff
path: root/obexd
diff options
context:
space:
mode:
authorChristian Fetzer <christian.fetzer@bmw-carit.de>2013-09-24 16:16:03 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-10-03 16:46:41 +0300
commit0e346308d8666708a246bf97c3580e4ef7833c01 (patch)
treea0c2b3d40562cd12d69dfe7e6de9bda707c4d3ee /obexd
parentd4d2b1a1dd71865fc1750633efa5a28d16a73c9e (diff)
obexd: Handle message status events
For outgoing messages, the message status is changed when an event indicates that the sending/delivery has failed or succeeded.
Diffstat (limited to 'obexd')
-rw-r--r--obexd/client/map.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/obexd/client/map.c b/obexd/client/map.c
index a8b12db04..20946fe63 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;
}