[PATCH 2/2] obexd: Add property Folder to MAP message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Fetzer <christian.fetzer@xxxxxxxxxxxx>

diff --git a/obexd/client/map.c b/obexd/client/map.c
index 3d8acc4..83da09b 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 },
@@ -766,7 +779,8 @@ static const GDBusPropertyTable map_msg_properties[] = {
 	{ }
 };
 
-static struct map_msg *map_msg_create(struct map_data *data, const char *handle)
+static struct map_msg *map_msg_create(struct map_data *data, const char *handle,
+							const char *folder)
 {
 	struct map_msg *msg;
 
@@ -775,6 +789,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(folder);
 
 	if (!g_dbus_register_interface(conn, msg->path, MAP_MSG_INTERFACE,
 						map_msg_methods, NULL,
@@ -989,7 +1004,8 @@ static void msg_element(GMarkupParseContext *ctxt, const char *element,
 
 	msg = g_hash_table_lookup(data->messages, values[i]);
 	if (msg == NULL) {
-		msg = map_msg_create(data, values[i]);
+		msg = map_msg_create(data, values[i],
+				obc_session_get_current_path(data->session));
 		if (msg == NULL)
 			return;
 	}
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux