Diff between 7a92ff811003bf2d04d9e3f74be5faca247f2368 and 3871079dc42a75b1253d1c5e4ee9dccd4f6d715f

Changed Files

File Additions Deletions Status
obexd/client/main.c +3 -1 modified
obexd/client/session.c +39 -3 modified
obexd/client/session.h +1 -0 modified

Full Patch

diff --git a/obexd/client/main.c b/obexd/client/main.c
index 8a8cfb2..7338e4e 100644
--- a/obexd/client/main.c
+++ b/obexd/client/main.c
@@ -62,8 +62,10 @@ static void create_callback(struct session_data *session, void *user_data)
 
 	g_dbus_send_reply(data->connection, data->message, DBUS_TYPE_INVALID);
 
-	if (session->target != NULL)
+	if (session->target != NULL) {
+		session_register(session);
 		goto done;
+	}
 
 	session_set_agent(session, data->sender, data->agent);
 
diff --git a/obexd/client/session.c b/obexd/client/session.c
index a4af371..367a17b 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -44,7 +44,8 @@
 #define AGENT_INTERFACE  "org.openobex.Agent"
 
 #define TRANSFER_INTERFACE  "org.openobex.Transfer"
-#define TRANSFER_BASEPATH   "/org/openobex"
+#define SESSION_INTERFACE  "org.openobex.Session"
+#define BASEPATH   "/org/openobex"
 
 #define FOLDER_BROWSING_UUID	"\xF9\xEC\x7B\xC4\x95\x3C\x11\xD2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
 
@@ -504,6 +505,25 @@ static GDBusMethodTable transfer_methods[] = {
 	{ }
 };
 
+static DBusMessage *assign_agent(DBusConnection *connection,
+				DBusMessage *message, void *user_data)
+{
+	return dbus_message_new_method_return(message);
+}
+
+static DBusMessage *release_agent(DBusConnection *connection,
+				DBusMessage *message, void *user_data)
+{
+	return dbus_message_new_method_return(message);
+}
+
+static GDBusMethodTable session_methods[] = {
+	{ "GetProperties",	"", "a{sv}",	get_properties	},
+	{ "AssignAgent",	"o", "",	assign_agent	},
+	{ "ReleaseAgent",	"o", "",	release_agent	},
+	{ }
+};
+
 static void xfer_progress(GwObexXfer *xfer, gpointer user_data)
 {
 	struct session_data *session = user_data;
@@ -611,8 +631,8 @@ int session_send(struct session_data *session, const char *filename)
 	session->filename = g_strdup(filename);
 
 	session->name = g_path_get_basename(filename);
-	session->path = g_strdup_printf("%s/transfer%ld",
-						TRANSFER_BASEPATH, counter++);
+	session->path = g_strdup_printf("%s/transfer%llu",
+					BASEPATH, counter++);
 
 	if (g_dbus_register_interface(session->conn, session->path,
 					TRANSFER_INTERFACE,
@@ -652,3 +672,19 @@ int session_send(struct session_data *session, const char *filename)
 
 	return 0;
 }
+
+int session_register(struct session_data *session)
+{
+	session->path = g_strdup_printf("%s/session%llu",
+					BASEPATH, counter++);
+
+	if (g_dbus_register_interface(session->conn, session->path,
+				SESSION_INTERFACE,
+				session_methods, NULL, NULL,
+				session, NULL) == FALSE)
+		return -EIO;
+
+	session_ref(session);
+
+	return 0;
+}
diff --git a/obexd/client/session.h b/obexd/client/session.h
index d74706b..39f74b8 100644
--- a/obexd/client/session.h
+++ b/obexd/client/session.h
@@ -59,3 +59,4 @@ int session_create(const char *source,
 int session_set_agent(struct session_data *session, const char *name,
 							const char *path);
 int session_send(struct session_data *session, const char *filename);
+int session_register(struct session_data *session);