Diff between 82f72d168b4e05d020e22014492c8bb26a3c3baa and 8348e53d250ebede40dee2cb1b2c703f2ef29e97

Changed Files

File Additions Deletions Status
tools/obexctl.c +56 -11 modified

Full Patch

diff --git a/tools/obexctl.c b/tools/obexctl.c
index f7c64e0..931ff26 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -1698,32 +1698,77 @@ static void delete_setup(DBusMessageIter *iter, void *user_data)
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &file);
 }
 
-static void cmd_rm(int argc, char *argv[])
+static void ftp_rm(GDBusProxy *proxy, int argc, char *argv[])
 {
-	GDBusProxy *proxy;
+	if (argc < 2) {
+		rl_printf("Missing file argument\n");
+		return;
+	}
 
-	if (!check_default_session())
+	if (g_dbus_proxy_method_call(proxy, "Delete", delete_setup,
+					delete_reply, g_strdup(argv[1]),
+					g_free) == FALSE) {
+		rl_printf("Failed to Delete\n");
 		return;
+	}
+
+	rl_printf("Attempting to Delete\n");
+}
+
+static void set_delete_reply(const DBusError *error, void *user_data)
+{
+	if (dbus_error_is_set(error))
+		rl_printf("Failed to set Deleted: %s\n", error->name);
+	else
+		rl_printf("Set Deleted successful\n");
+}
+
+static void map_rm(GDBusProxy *proxy, int argc, char *argv[])
+{
+	GDBusProxy *msg;
+	dbus_bool_t value = TRUE;
 
 	if (argc < 2) {
-		rl_printf("Missing file argument\n");
+		rl_printf("Missing message argument\n");
 		return;
 	}
 
+	msg = find_message(argv[1]);
+	if (msg == NULL) {
+		rl_printf("Invalid message argument\n");
+		return;
+	}
+
+	if (g_dbus_proxy_set_property_basic(msg, "Deleted", DBUS_TYPE_BOOLEAN,
+						&value, set_delete_reply,
+						NULL, NULL) == FALSE) {
+		rl_printf("Failed to set Deleted\n");
+		return;
+	}
+
+	rl_printf("Attempting to set Deleted\n");
+}
+
+static void cmd_rm(int argc, char *argv[])
+{
+	GDBusProxy *proxy;
+
+	if (!check_default_session())
+		return;
+
 	proxy = find_ftp(g_dbus_proxy_get_path(default_session));
-	if (proxy == NULL) {
-		rl_printf("Command not supported\n");
+	if (proxy) {
+		ftp_rm(proxy, argc, argv);
 		return;
 	}
 
-	if (g_dbus_proxy_method_call(proxy, "Delete", delete_setup,
-					delete_reply, g_strdup(argv[1]),
-					g_free) == FALSE) {
-		rl_printf("Failed to Delete\n");
+	proxy = find_map(g_dbus_proxy_get_path(default_session));
+	if (proxy) {
+		map_rm(proxy, argc, argv);
 		return;
 	}
 
-	rl_printf("Attempting to Delete\n");
+	rl_printf("Command not supported\n");
 }
 
 static void create_folder_reply(DBusMessage *message, void *user_data)