Diff between ea5d38411a2e80b2c978cd9f8378c9be0638bb66 and d77a640090c808d0ea24e0ec48d6cd6d6025f07a

Changed Files

File Additions Deletions Status
obexd/client/map.c +58 -0 modified

Full Patch

diff --git a/obexd/client/map.c b/obexd/client/map.c
index 290eaae..46b787d 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1242,6 +1242,60 @@ static DBusMessage *map_list_filter_fields(DBusConnection *connection,
 	return reply;
 }
 
+static void update_inbox_cb(struct obc_session *session,
+				struct obc_transfer *transfer,
+				GError *err, void *user_data)
+{
+	struct map_data *map = user_data;
+	DBusMessage *reply;
+
+	if (err != NULL) {
+		reply = g_dbus_create_error(map->msg,
+						ERROR_INTERFACE ".Failed",
+						"%s", err->message);
+		goto done;
+	}
+
+	reply = dbus_message_new_method_return(map->msg);
+
+done:
+	g_dbus_send_message(conn, reply);
+	dbus_message_unref(map->msg);
+}
+
+static DBusMessage *map_update_inbox(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	struct map_data *map = user_data;
+	DBusMessage *reply;
+	char contents[2];
+	struct obc_transfer *transfer;
+	GError *err = NULL;
+
+	contents[0] = FILLER_BYTE;
+	contents[1] = '\0';
+
+	transfer = obc_transfer_put("x-bt/MAP-messageUpdate", NULL, NULL,
+						contents, sizeof(contents),
+						&err);
+	if (transfer == NULL)
+		goto fail;
+
+	if (!obc_session_queue(map->session, transfer, update_inbox_cb,
+								map, &err))
+		goto fail;
+
+	map->msg = dbus_message_ref(message);
+
+	return NULL;
+
+fail:
+	reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
+								err->message);
+	g_error_free(err);
+	return reply;
+}
+
 static const GDBusMethodTable map_methods[] = {
 	{ GDBUS_ASYNC_METHOD("SetFolder",
 				GDBUS_ARGS({ "name", "s" }), NULL,
@@ -1258,6 +1312,10 @@ static const GDBusMethodTable map_methods[] = {
 			NULL,
 			GDBUS_ARGS({ "fields", "as" }),
 			map_list_filter_fields) },
+	{ GDBUS_ASYNC_METHOD("UpdateInbox",
+			NULL,
+			NULL,
+			map_update_inbox) },
 	{ }
 };