linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 09/10] client: Add MessageAccess.GetMessage implementation
Date: Wed, 27 Jun 2012 15:04:54 +0300	[thread overview]
Message-ID: <1340798695-6785-9-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1340798695-6785-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 client/map.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/client/map.c b/client/map.c
index b8c0cb8..e5236d0 100644
--- a/client/map.c
+++ b/client/map.c
@@ -378,6 +378,38 @@ fail:
 	return reply;
 }
 
+static DBusMessage *map_get_message(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	struct map_data *map = user_data;
+	struct obc_transfer *transfer;
+	const char *handle, *target_file;
+	GError *err = NULL;
+	DBusMessage *reply;
+
+	if (dbus_message_get_args(message, NULL,
+				DBUS_TYPE_STRING, &handle,
+				DBUS_TYPE_STRING, &target_file,
+				DBUS_TYPE_INVALID) == FALSE)
+		return g_dbus_create_error(message,
+				ERROR_INTERFACE ".InvalidArguments", NULL);
+
+	transfer = obc_transfer_get("x-bt/message", handle, target_file, &err);
+	if (transfer == NULL)
+		goto fail;
+
+	if (!obc_session_queue(map->session, transfer, NULL, NULL, &err))
+		goto fail;
+
+	return obc_transfer_create_dbus_reply(transfer, message);
+
+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,
@@ -390,6 +422,11 @@ static const GDBusMethodTable map_methods[] = {
 			GDBUS_ARGS({ "folder", "s" }, { "filter", "a{ss}" }),
 			GDBUS_ARGS({ "messages", "aa{sv}" }),
 			map_get_message_listing) },
+	{ GDBUS_METHOD("GetMessage",
+			GDBUS_ARGS({ "handle", "s" }, { "file", "s" }),
+			GDBUS_ARGS({ "transfer", "o" },
+						{ "properties", "a{sv}" }),
+			map_get_message) },
 	{ }
 };
 
-- 
1.7.10.2


  parent reply	other threads:[~2012-06-27 12:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 12:04 [PATCH obexd 01/10] client: Change MessageAccess.GetFolderListing to not return raw xml Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 02/10] test: Update map-client to the changes in GetFolderListing Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 03/10] client-doc: Add documentation of MessageAccess.GetFolderListing Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 04/10] client: Change MessageAccess.GetMessageListing to not return raw xml Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 05/10] test: Update map-client to the changes in GetMessageListing Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 06/10] client-doc: Add documentation of MessageAccess.GetMessageListing Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 07/10] client: Use filter instead of dummy as argument name in MAP Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 08/10] client-doc: Add documentation of MessageAccess.GetMessage Luiz Augusto von Dentz
2012-06-27 12:04 ` Luiz Augusto von Dentz [this message]
2012-06-27 12:04 ` [PATCH obexd 10/10] test: Add support for MessageAccess.GetMessage to map-client Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340798695-6785-9-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).