From 73ba38a47535440738ada0e8cdfc7b2516c55e3f Mon Sep 17 00:00:00 2001 From: Slawomir Bochenski Date: Thu, 12 Apr 2012 20:53:29 +0200 Subject: [PATCH] obexd: Output parameters for GetMessagesListing This sets the parameters returned from MAP backend for GetMessagesListing to be used in application parameters header sent in response. --- obexd/plugins/mas.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c index 76dc8e948..576c206bd 100644 --- a/obexd/plugins/mas.c +++ b/obexd/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); } -- 2.47.3