linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Slawomir Bochenski <lkslawek@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: johan.hedberg@gmail.com, Slawomir Bochenski <lkslawek@gmail.com>
Subject: [PATCH obexd v3 2/3] MAP/dummy: Code for returning folder listing
Date: Fri,  9 Mar 2012 08:06:33 +0100	[thread overview]
Message-ID: <1331276794-14160-2-git-send-email-lkslawek@gmail.com> (raw)
In-Reply-To: <1331276794-14160-1-git-send-email-lkslawek@gmail.com>

---
 plugins/messages-dummy.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/plugins/messages-dummy.c b/plugins/messages-dummy.c
index cfb24e2..00cca59 100644
--- a/plugins/messages-dummy.c
+++ b/plugins/messages-dummy.c
@@ -119,6 +119,28 @@ static ssize_t get_subdirs(struct folder_listing_data *fld, GSList **list)
 static void return_folder_listing(struct folder_listing_data *fld, GSList *list)
 {
 	struct session *session = fld->session;
+	GSList *cur;
+	uint16_t n = 0;
+	uint16_t o = 0;
+
+	/* XXX: This isn't really documented for MAP. I need to take a look how
+	 * other implementations choose to deal with parent folder.
+	 */
+	if (session->cwd[0] != 0 && fld->offset == 0) {
+		++n;
+		fld->callback(session, -EAGAIN, 0, "..", fld->user_data);
+	} else {
+		++o;
+	}
+
+	for (cur = list; o < fld->offset; ++o) {
+		cur = cur->next;
+		if (cur == NULL)
+			break;
+	}
+
+	for (; cur != NULL && n < fld->max; cur = cur->next, ++n)
+		fld->callback(session, -EAGAIN, 0, cur->data, fld->user_data);
 
 	fld->callback(session, 0, 0, NULL, fld->user_data);
 }
-- 
1.7.4.1


  reply	other threads:[~2012-03-09  7:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09  7:06 [PATCH obexd v3 1/3] MAP/dummy: Actual code for folder listing retrieval Slawomir Bochenski
2012-03-09  7:06 ` Slawomir Bochenski [this message]
2012-03-09  7:06 ` [PATCH obexd v3 3/3] MAP/dummy: Add sorting of folder listing Slawomir Bochenski

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=1331276794-14160-2-git-send-email-lkslawek@gmail.com \
    --to=lkslawek@gmail.com \
    --cc=johan.hedberg@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;
as well as URLs for NNTP newsgroup(s).