From 4fa9cbfeaa6c9c324a508c59a688754cd96946c9 Mon Sep 17 00:00:00 2001 From: Christian Fetzer <christian.fetzer@bmw-carit.de> Date: Fri, 30 Aug 2013 14:45:12 +0200 Subject: [PATCH] obexd: Add property Folder to MAP message --- doc/obex-api.txt | 6 +++++- obexd/client/map.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/obex-api.txt b/doc/obex-api.txt index 22449c4ca..0a8e632c1 100644 --- a/doc/obex-api.txt +++ b/doc/obex-api.txt @@ -735,7 +735,11 @@ Methods object, dict Get(string targetfile, boolean attachment) Possible errors: org.bluez.obex.Error.InvalidArguments org.bluez.obex.Error.Failed -Properties string Subject [readonly] +Properties string Folder [readonly] + + Folder which the message belongs to + + string Subject [readonly] Message subject diff --git a/obexd/client/map.c b/obexd/client/map.c index 8864a5459..721fa253c 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -123,6 +123,7 @@ struct map_msg { char *status; uint64_t attachment_size; uint8_t flags; + char *folder; GDBusPendingPropertySet pending; }; @@ -379,6 +380,7 @@ static void map_msg_free(void *data) g_free(msg->path); g_free(msg->subject); g_free(msg->handle); + g_free(msg->folder); g_free(msg->timestamp); g_free(msg->sender); g_free(msg->sender_address); @@ -451,6 +453,16 @@ done: msg->pending = 0; } +static gboolean get_folder(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct map_msg *msg = data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &msg->folder); + + return TRUE; +} + static gboolean subject_exists(const GDBusPropertyTable *property, void *data) { struct map_msg *msg = data; @@ -744,6 +756,7 @@ static const GDBusMethodTable map_msg_methods[] = { }; static const GDBusPropertyTable map_msg_properties[] = { + { "Folder", "s", get_folder }, { "Subject", "s", get_subject, NULL, subject_exists }, { "Timestamp", "s", get_timestamp, NULL, timestamp_exists }, { "Sender", "s", get_sender, NULL, sender_exists }, @@ -775,6 +788,7 @@ static struct map_msg *map_msg_create(struct map_data *data, const char *handle) msg->path = g_strdup_printf("%s/message%s", obc_session_get_path(data->session), handle); + msg->folder = g_strdup(obc_session_get_folder(data->session)); if (!g_dbus_register_interface(conn, msg->path, MAP_MSG_INTERFACE, map_msg_methods, NULL, -- 2.11.0