From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 6/8] client: Fix not sending parameters to get message in map module
Date: Thu, 13 Sep 2012 16:06:59 +0300 [thread overview]
Message-ID: <1347541621-26858-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1347541621-26858-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Attachment and charset are mandatory, so Message.Get now takes an
additional boolean parameter which the user application should set
if it wants the attachments to be downloaded, charset is always set
to UTF8.
---
client/map.c | 20 +++++++++++++++++++-
doc/client-api.txt | 2 +-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/client/map.c b/client/map.c
index cf3d8ed..4b5f8a2 100644
--- a/client/map.c
+++ b/client/map.c
@@ -53,6 +53,8 @@
#define DEFAULT_COUNT 1024
#define DEFAULT_OFFSET 0
+#define CHARSET_UTF8 1
+
static const char * const filter_list[] = {
"subject",
"timestamp",
@@ -377,11 +379,16 @@ static DBusMessage *map_msg_get(DBusConnection *connection,
struct map_msg *msg = user_data;
struct obc_transfer *transfer;
const char *target_file;
+ gboolean attachment;
GError *err = NULL;
DBusMessage *reply;
+ GObexApparam *apparam;
+ guint8 buf[6];
+ gsize len;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_STRING, &target_file,
+ DBUS_TYPE_BOOLEAN, &attachment,
DBUS_TYPE_INVALID) == FALSE)
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
@@ -391,6 +398,16 @@ static DBusMessage *map_msg_get(DBusConnection *connection,
if (transfer == NULL)
goto fail;
+ apparam = g_obex_apparam_set_uint8(NULL, MAP_AP_ATTACHMENT,
+ attachment);
+ apparam = g_obex_apparam_set_uint8(apparam, MAP_AP_CHARSET,
+ CHARSET_UTF8);
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+
+ obc_transfer_set_params(transfer, buf, len);
+
+ g_obex_apparam_free(apparam);
+
if (!obc_session_queue(msg->data->session, transfer, NULL, NULL, &err))
goto fail;
@@ -405,7 +422,8 @@ fail:
static const GDBusMethodTable map_msg_methods[] = {
{ GDBUS_METHOD("Get",
- GDBUS_ARGS({ "targetfile", "s" }),
+ GDBUS_ARGS({ "targetfile", "s" },
+ { "attachment", "b" }),
GDBUS_ARGS({ "transfer", "o" },
{ "properties", "a{sv}" }),
map_msg_get) },
diff --git a/doc/client-api.txt b/doc/client-api.txt
index f78b8fe..25fd3e4 100644
--- a/doc/client-api.txt
+++ b/doc/client-api.txt
@@ -520,7 +520,7 @@ Service org.bluez.obex.client
Interface org.bluez.obex.Message
Object path [variable prefix]/{session0,session1,...}/{message0,...}
-Methods object, dict Get(string targetfile)
+Methods object, dict Get(string targetfile, boolean attachment)
Download message and store it in the target file.
--
1.7.11.4
next prev parent reply other threads:[~2012-09-13 13:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 13:06 [PATCH obexd 1/8] client: Rename MessageAccess method GetFolderListing to ListFolders Luiz Augusto von Dentz
2012-09-13 13:06 ` [PATCH obexd 2/8] client: Rename MessageAccess method GetMessagesListing to ListMessages Luiz Augusto von Dentz
2012-09-13 13:06 ` [PATCH obexd 3/8] client: Add MessageAccess.ListFilterFields Luiz Augusto von Dentz
2012-09-13 13:06 ` [PATCH obexd 4/8] client-doc: Update documentation of MessageAccess interface Luiz Augusto von Dentz
2012-09-13 13:06 ` [PATCH obexd 5/8] test: Update map-client to work with changes in " Luiz Augusto von Dentz
2012-09-13 13:06 ` Luiz Augusto von Dentz [this message]
2012-09-13 13:07 ` [PATCH obexd 7/8] test: Update map-client to work with changes in Message.Get Luiz Augusto von Dentz
2012-09-13 13:07 ` [PATCH obexd 8/8] client: Avoid extra copies while passing apparam to transfer 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=1347541621-26858-6-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