Diff between 432dffc3d2ac79f4d99de4ab9bcc42f385ea4b5a and 405afea4a5d6a2a7ac42ed99d792135a0a20ddcd

Changed Files

File Additions Deletions Status
doc/obexd-api.txt +5 -0 modified
obexd/client/transfer.c +17 -2 modified
obexd/client/transfer.h +1 -1 modified

Full Patch

diff --git a/doc/obexd-api.txt b/doc/obexd-api.txt
index 08c333d..b0b3068 100644
--- a/doc/obexd-api.txt
+++ b/doc/obexd-api.txt
@@ -121,6 +121,11 @@ Properties	string Status [readonly]
 			Possible values: "queued", "active", "complete" or
 					"error"
 
+		object Session [readonly]
+
+			The object path of the session the transfer belongs
+			to.
+
 		string Name [readonly]
 
 			Name of the transferred object.
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index aa29b49..3b4a003 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -72,6 +72,7 @@ struct obc_transfer {
 	struct transfer_callback *callback;
 	DBusConnection *conn;
 	DBusMessage *msg;
+	char *session;		/* Session path */
 	char *owner;		/* Transfer initiator */
 	char *path;		/* Transfer path */
 	gchar *filename;	/* Transfer file location */
@@ -286,6 +287,17 @@ static gboolean get_status(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean get_session(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct obc_transfer *transfer = data;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
+							&transfer->session);
+
+	return TRUE;
+}
+
 static const GDBusMethodTable obc_transfer_methods[] = {
 	{ GDBUS_ASYNC_METHOD("Cancel", NULL, NULL,
 				obc_transfer_cancel) },
@@ -298,6 +310,7 @@ static const GDBusPropertyTable obc_transfer_properties[] = {
 	{ "Size", "t", get_size },
 	{ "Filename", "s", get_filename, NULL, filename_exists },
 	{ "Transferred", "t", get_transferred, NULL, transferred_exists },
+	{ "Session", "o", get_session },
 	{ }
 };
 
@@ -337,6 +350,7 @@ static void obc_transfer_free(struct obc_transfer *transfer)
 	g_free(transfer->filename);
 	g_free(transfer->name);
 	g_free(transfer->type);
+	g_free(transfer->session);
 	g_free(transfer->path);
 	g_free(transfer);
 }
@@ -359,13 +373,14 @@ static struct obc_transfer *obc_transfer_create(guint8 op,
 
 gboolean obc_transfer_register(struct obc_transfer *transfer,
 						DBusConnection *conn,
-						const char *path,
+						const char *session,
 						const char *owner,
 						GError **err)
 {
 	transfer->owner = g_strdup(owner);
 
-	transfer->path = g_strdup_printf("%s/transfer%ju", path, counter++);
+	transfer->session = g_strdup(session);
+	transfer->path = g_strdup_printf("%s/transfer%ju", session, counter++);
 
 	transfer->conn = dbus_connection_ref(conn);
 	if (transfer->conn == NULL) {
diff --git a/obexd/client/transfer.h b/obexd/client/transfer.h
index f7d0423..b6b835d 100644
--- a/obexd/client/transfer.h
+++ b/obexd/client/transfer.h
@@ -36,7 +36,7 @@ struct obc_transfer *obc_transfer_put(const char *type, const char *name,
 
 gboolean obc_transfer_register(struct obc_transfer *transfer,
 					DBusConnection *conn,
-					const char *path,
+					const char *session,
 					const char *owner,
 					GError **err);