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: Slawomir Bochenski <lkslawek@gmail.com>
Subject: [PATCH obexd 1/5] MAP/dummy: Add stub for asynchronous folder listing
Date: Tue,  6 Mar 2012 18:42:24 +0100	[thread overview]
Message-ID: <1331055748-14212-1-git-send-email-lkslawek@gmail.com> (raw)

---
 plugins/messages-dummy.c |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/plugins/messages-dummy.c b/plugins/messages-dummy.c
index 511857e..3ba333c 100644
--- a/plugins/messages-dummy.c
+++ b/plugins/messages-dummy.c
@@ -36,8 +36,23 @@ static char *root_folder = NULL;
 struct session {
 	char *cwd;
 	char *cwd_absolute;
+	void *request;
 };
 
+struct folder_listing_data {
+	struct session *session;
+	const char *name;
+	uint16_t max;
+	uint16_t offset;
+	messages_folder_listing_cb callback;
+	void *user_data;
+};
+
+static gboolean get_folder_listing(void *d)
+{
+	return FALSE;
+}
+
 int messages_init(void)
 {
 	char *tmp;
@@ -142,12 +157,28 @@ int messages_set_folder(void *s, const char *name, gboolean cdup)
 	return 0;
 }
 
-int messages_get_folder_listing(void *session, const char *name, uint16_t max,
+int messages_get_folder_listing(void *s, const char *name, uint16_t max,
 					uint16_t offset,
 					messages_folder_listing_cb callback,
 					void *user_data)
 {
-	return -ENOSYS;
+	struct session *session =  s;
+	struct folder_listing_data *fld;
+
+	fld = g_new0(struct folder_listing_data, 1);
+	fld->session = session;
+	fld->name = name;
+	fld->max = max;
+	fld->offset = offset;
+	fld->callback = callback;
+	fld->user_data = user_data;
+
+	session->request = fld;
+
+	g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, get_folder_listing,
+								fld, g_free);
+
+	return 0;
 }
 
 int messages_get_messages_listing(void *session, const char *name,
@@ -173,6 +204,12 @@ int messages_update_inbox(void *session, messages_update_inbox_cb callback,
 	return -ENOSYS;
 }
 
-void messages_abort(void *session)
+void messages_abort(void *s)
 {
+	struct session *session = s;
+
+	if (session->request) {
+		g_idle_remove_by_data(session->request);
+		session->request = NULL;
+	}
 }
-- 
1.7.5.1


             reply	other threads:[~2012-03-06 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 17:42 Slawomir Bochenski [this message]
2012-03-06 17:42 ` [PATCH obexd 2/5] MAP/dummy: Add basic logic for folder listing Slawomir Bochenski
2012-03-06 17:42 ` [PATCH obexd 3/5] MAP/dummy: Actual code for folder listing retrieval Slawomir Bochenski
2012-03-08 23:36   ` Johan Hedberg
2012-03-06 17:42 ` [PATCH obexd 4/5] MAP/dummy: Code for returning folder listing Slawomir Bochenski
2012-03-06 17:42 ` [PATCH obexd 5/5] MAP/dummy: Add sorting of " 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=1331055748-14212-1-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 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).