From c55ebae4311dd4a4e5d2a019ca6befee3ea30b97 Mon Sep 17 00:00:00 2001 From: Christian Fetzer Date: Tue, 24 Sep 2013 16:16:06 +0200 Subject: obexd: Handle message shift and message deleted events Update Folder propery if the message has been shifted or deleted. --- obexd/client/map.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'obexd') diff --git a/obexd/client/map.c b/obexd/client/map.c index 20946fe63..68bd99879 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -1857,6 +1857,29 @@ static void map_handle_status_changed(struct map_data *map, "Status"); } +static void map_handle_folder_changed(struct map_data *map, + struct map_event *event, + const char *folder) +{ + struct map_msg *msg; + + if (!folder) + return; + + msg = g_hash_table_lookup(map->messages, event->handle); + if (!msg) + return; + + if (g_strcmp0(msg->folder, folder) == 0) + return; + + g_free(msg->folder); + msg->folder = g_strdup(folder); + + g_dbus_emit_property_changed(conn, msg->path, MAP_MSG_INTERFACE, + "Folder"); +} + static void map_handle_notification(struct map_event *event, void *user_data) { struct map_data *map = user_data; @@ -1883,6 +1906,12 @@ static void map_handle_notification(struct map_event *event, void *user_data) case MAP_ET_SENDING_FAILURE: map_handle_status_changed(map, event, "sending-failure"); break; + case MAP_ET_MESSAGE_DELETED: + map_handle_folder_changed(map, event, "/telecom/msg/deleted"); + break; + case MAP_ET_MESSAGE_SHIFT: + map_handle_folder_changed(map, event, event->folder); + break; default: break; } -- cgit v1.2.3