All of lore.kernel.org
 help / color / mirror / Atom feed
From: Slawomir Bochenski <lkslawek@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Slawomir Bochenski <lkslawek@gmail.com>
Subject: [PATCH obexd v3 3/3] MAP: Output parameters for GetMessagesListing
Date: Thu, 12 Apr 2012 20:53:29 +0200	[thread overview]
Message-ID: <1334256809-15052-3-git-send-email-lkslawek@gmail.com> (raw)
In-Reply-To: <1334256809-15052-1-git-send-email-lkslawek@gmail.com>

This sets the parameters returned from MAP backend for
GetMessagesListing to be used in application parameters header sent in
response.
---
 plugins/mas.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/plugins/mas.c b/plugins/mas.c
index 76dc8e9..576c206 100644
--- a/plugins/mas.c
+++ b/plugins/mas.c
@@ -282,12 +282,22 @@ static void get_messages_listing_cb(void *session, int err, uint16_t size,
 					void *user_data)
 {
 	struct mas_session *mas = user_data;
+	uint16_t max = 1024;
 
 	if (err < 0 && err != -EAGAIN) {
 		obex_object_set_io_flags(mas, G_IO_ERR, err);
 		return;
 	}
 
+	map_ap_get_u16(mas->inparams, MAP_AP_MAXLISTCOUNT, &max);
+
+	if (max == 0) {
+		if (!entry)
+			mas->finished = TRUE;
+
+		goto proceed;
+	}
+
 	if (!mas->nth_call) {
 		g_string_append(mas->buffer, ML_BODY_BEGIN);
 		mas->nth_call = TRUE;
@@ -379,6 +389,13 @@ static void get_messages_listing_cb(void *session, int err, uint16_t size,
 	g_string_append(mas->buffer, "/>\n");
 
 proceed:
+	if (!entry) {
+		map_ap_set_u16(mas->outparams, MAP_AP_MESSAGESLISTINGSIZE,
+							size);
+		map_ap_set_u8(mas->outparams, MAP_AP_NEWMESSAGE,
+							newmsg ? 1 : 0);
+	}
+
 	if (err != -EAGAIN)
 		obex_object_set_io_flags(mas, G_IO_IN, 0);
 }
-- 
1.7.5.1


  parent reply	other threads:[~2012-04-12 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 18:53 [PATCH obexd v3 1/3] MAP: Mark filter strings const Slawomir Bochenski
2012-04-12 18:53 ` [PATCH obexd v3 2/3] MAP: Input parameters for GetMessagesListing Slawomir Bochenski
2012-04-12 18:53 ` Slawomir Bochenski [this message]
2012-04-12 19:00 ` [PATCH obexd v3 1/3] MAP: Mark filter strings const Johan Hedberg

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=1334256809-15052-3-git-send-email-lkslawek@gmail.com \
    --to=lkslawek@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 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.