All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ronald Tessier <ronald.tessier@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 3/4] service: Add DBus method to set delivery-report
Date: Mon, 23 Jul 2012 16:18:16 +0200	[thread overview]
Message-ID: <1343053097-8908-4-git-send-email-ronald.tessier@linux.intel.com> (raw)
In-Reply-To: <1343053097-8908-1-git-send-email-ronald.tessier@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2547 bytes --]

---
 doc/service-api.txt |    6 ++++++
 src/service.c       |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/doc/service-api.txt b/doc/service-api.txt
index 02396ff..f247d3a 100644
--- a/doc/service-api.txt
+++ b/doc/service-api.txt
@@ -82,6 +82,12 @@ Methods		array{object,dict} GetMessages()
 
 			Possible Errors: [service].Error.InvalidArguments
 
+		void SetProperty(string name, variant value)
+
+			Changes the value of the specified property.
+
+			Possible Errors: [service].Error.InvalidArguments
+
 
 Signals		MessageAdded(object path, dict properties)
 
diff --git a/src/service.c b/src/service.c
index 7243efd..c1ca4ab 100644
--- a/src/service.c
+++ b/src/service.c
@@ -887,6 +887,48 @@ out:
 	return reply;
 }
 
+static DBusMessage *set_property(DBusConnection *conn, DBusMessage *dbus_msg,
+								void *data)
+{
+	struct mms_service *service = data;
+	DBusMessageIter iter;
+	DBusMessageIter var;
+	const char *property;
+
+	if (!dbus_message_iter_init(dbus_msg, &iter))
+		return __mms_error_invalid_args(dbus_msg);
+
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+		return __mms_error_invalid_args(dbus_msg);
+
+	dbus_message_iter_get_basic(&iter, &property);
+	dbus_message_iter_next(&iter);
+
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+		return __mms_error_invalid_args(dbus_msg);
+
+	dbus_message_iter_recurse(&iter, &var);
+
+	if (!strcmp(property, "UseDeliveryReports")) {
+		dbus_bool_t value;
+
+		if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
+			return __mms_error_invalid_args(dbus_msg);
+
+		dbus_message_iter_get_basic(&var, &value);
+
+		if (service->use_delivery_reports != (gboolean) value) {
+			DBG("use_delivery_reports = %d", value);
+
+			service->use_delivery_reports = value;
+		}
+
+		return g_dbus_create_reply(dbus_msg, DBUS_TYPE_INVALID);
+	}
+
+	return __mms_error_invalid_args(dbus_msg);
+}
+
 static gboolean mms_attachment_is_smil(const struct mms_attachment *part)
 {
 	if (g_str_has_prefix(part->content_type, "application/smil"))
@@ -1023,6 +1065,10 @@ static const GDBusMethodTable service_methods[] = {
 			GDBUS_ARGS({ "number", "s" }, { "count", "s" }),
 			GDBUS_ARGS({ "messages_with_properties", "a(oa{sv}" }),
 			get_conversation) },
+	{ GDBUS_METHOD("SetProperty",
+			GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
+		       NULL,
+			set_property) },
 	{ }
 };
 
-- 
1.7.9.5


  parent reply	other threads:[~2012-07-23 14:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 14:18 [PATCH 0/4] mmsd: delivery-report flag Ronald Tessier
2012-07-23 14:18 ` [PATCH 1/4] store: Add utilities for mms settings file access Ronald Tessier
2012-07-23 14:18 ` [PATCH 2/4] service: Load delivery-report from mms settings Ronald Tessier
2012-07-23 14:18 ` Ronald Tessier [this message]
2012-07-23 14:18 ` [PATCH 4/4] test: Add a script to set the delivery-report flag Ronald Tessier
2012-08-06 15:30 [PATCH 0/4] mmsd: " Ronald Tessier
2012-08-06 15:30 ` [PATCH 3/4] service: Add DBus method to set delivery-report Ronald Tessier
2012-08-07  7:21   ` Denis Kenzior

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=1343053097-8908-4-git-send-email-ronald.tessier@linux.intel.com \
    --to=ronald.tessier@linux.intel.com \
    --cc=ofono@ofono.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.