From: Ronald Tessier <ronald.tessier@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCHv1 2/5] service: Retrieve get_conversation() args
Date: Wed, 25 Apr 2012 11:01:50 +0200 [thread overview]
Message-ID: <1335344513-2347-3-git-send-email-ronald.tessier@linux.intel.com> (raw)
In-Reply-To: <1335344513-2347-1-git-send-email-ronald.tessier@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]
---
src/service.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/service.c b/src/service.c
index 24c89b6..18c11f4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -690,11 +690,48 @@ static DBusMessage *get_messages(DBusConnection *conn,
return reply;
}
+static gboolean get_conversation_get_args(DBusMessage *dbus_msg,
+ const char **number, unsigned int *count)
+{
+ DBusMessageIter top_iter;
+
+ if (dbus_message_iter_init(dbus_msg, &top_iter) == FALSE)
+ return FALSE;
+
+ if (dbus_message_iter_get_arg_type(&top_iter) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ dbus_message_iter_get_basic(&top_iter, number);
+ if (*number[0] == '\0')
+ return FALSE;
+
+ if (valid_number_format(*number) == FALSE)
+ return FALSE;
+
+ if (!dbus_message_iter_next(&top_iter))
+ return FALSE;
+
+ if (dbus_message_iter_get_arg_type(&top_iter) != DBUS_TYPE_UINT32)
+ return FALSE;
+
+ dbus_message_iter_get_basic(&top_iter, count);
+
+ return TRUE;
+}
+
static DBusMessage *get_conversation(DBusConnection *conn,
DBusMessage *dbus_msg, void *data)
{
DBusMessage *reply;
DBusMessageIter iter, array;
+ const char *number;
+ unsigned int count;
+
+ if (get_conversation_get_args(dbus_msg, &number, &count) == FALSE) {
+ mms_debug("Invalid arguments");
+
+ return __mms_error_invalid_args(dbus_msg);
+ }
reply = dbus_message_new_method_return(dbus_msg);
if (reply == NULL)
--
1.7.4.1
next prev parent reply other threads:[~2012-04-25 9:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 9:01 [PATCHv1 0/5] mmsd: GetConversation support Ronald Tessier
2012-04-25 9:01 ` [PATCHv1 1/5] service: Add GetConversation method Ronald Tessier
2012-04-27 12:26 ` Marcel Holtmann
2012-04-25 9:01 ` Ronald Tessier [this message]
2012-04-27 12:25 ` [PATCHv1 2/5] service: Retrieve get_conversation() args Marcel Holtmann
2012-04-25 9:01 ` [PATCHv1 3/5] service: Fill conversation list with messages Ronald Tessier
2012-04-27 12:25 ` Marcel Holtmann
2012-04-25 9:01 ` [PATCHv1 4/5] service: Sort conversation list by message date Ronald Tessier
2012-04-27 12:23 ` Marcel Holtmann
2012-04-25 9:01 ` [PATCHv1 5/5] doc: Update service-api.txt Ronald Tessier
2012-04-27 12:20 ` Marcel Holtmann
2012-04-27 13:30 ` Ronald Tessier
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=1335344513-2347-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox