Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 3/8] client: Add MessageAccess.ListFilterFields
Date: Thu, 13 Sep 2012 16:06:56 +0300	[thread overview]
Message-ID: <1347541621-26858-3-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>

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

diff --git a/client/map.c b/client/map.c
index 6d1b0f2..cf3d8ed 100644
--- a/client/map.c
+++ b/client/map.c
@@ -1011,6 +1011,41 @@ static DBusMessage *map_list_messages(DBusConnection *connection,
 	return get_message_listing(map, message, folder, apparam);
 }
 
+static gchar **get_filter_strs(uint64_t filter, gint *size)
+{
+	gchar **list, **item;
+	gint i;
+
+	list = g_malloc0(sizeof(gchar **) * (FILTER_BIT_MAX + 2));
+
+	item = list;
+
+	for (i = 0; filter_list[i] != NULL; i++)
+		if (filter & (1ULL << i))
+			*(item++) = g_strdup(filter_list[i]);
+
+	*item = NULL;
+	*size = item - list;
+	return list;
+}
+
+static DBusMessage *map_list_filter_fields(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	gchar **filters = NULL;
+	gint size;
+	DBusMessage *reply;
+
+	filters = get_filter_strs(FILTER_ALL, &size);
+	reply = dbus_message_new_method_return(message);
+	dbus_message_append_args(reply, DBUS_TYPE_ARRAY,
+				DBUS_TYPE_STRING, &filters, size,
+				DBUS_TYPE_INVALID);
+
+	g_strfreev(filters);
+	return reply;
+}
+
 static const GDBusMethodTable map_methods[] = {
 	{ GDBUS_ASYNC_METHOD("SetFolder",
 				GDBUS_ARGS({ "name", "s" }), NULL,
@@ -1023,6 +1058,10 @@ static const GDBusMethodTable map_methods[] = {
 			GDBUS_ARGS({ "folder", "s" }, { "filter", "a{sv}" }),
 			GDBUS_ARGS({ "messages", "a{oa{sv}}" }),
 			map_list_messages) },
+	{ GDBUS_METHOD("ListFilterFields",
+			NULL,
+			GDBUS_ARGS({ "fields", "as" }),
+			map_list_filter_fields) },
 	{ }
 };
 
-- 
1.7.11.4


  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 ` Luiz Augusto von Dentz [this message]
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 ` [PATCH obexd 6/8] client: Fix not sending parameters to get message in map module Luiz Augusto von Dentz
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-3-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