Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Add increasing query OFFSET in phonebook_pull_read
@ 2011-02-16  9:34 Radoslaw Jablonski
  2011-02-16 15:00 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Radoslaw Jablonski @ 2011-02-16  9:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Radoslaw Jablonski

It is needed to properly move starting index in tracker
for next invocations of phonebook_pull_read - without that
pull result for bigger queries (over one part of data) will
be wrong (it will include duplicate vcard entries).
---
 plugins/phonebook-tracker.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index eb38a46..28d5c7d 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -1964,6 +1964,7 @@ int phonebook_pull_read(void *request)
 	struct phonebook_data *data = request;
 	reply_list_foreach_t pull_cb;
 	const char *query;
+	char *offset_query;
 	int col_amount;
 	int ret;
 
@@ -1987,6 +1988,19 @@ int phonebook_pull_read(void *request)
 	if (query == NULL)
 		return -ENOENT;
 
+	if (pull_cb == pull_contacts && data->tracker_index > 0) {
+		/* Adding offset to pull query to download next parts of data
+		 * from tracker (phonebook_pull_read may be called many times
+		 * from PBAP core to fetch data partially) */
+		offset_query = g_strdup_printf(QUERY_OFFSET_FORMAT, query,
+							data->tracker_index);
+		ret = query_tracker(offset_query, col_amount, pull_cb, data);
+
+		g_free(offset_query);
+
+		return ret;
+	}
+
 	ret = query_tracker(query, col_amount, pull_cb, data);
 
 	return ret;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add increasing query OFFSET in phonebook_pull_read
  2011-02-16  9:34 [PATCH] Add increasing query OFFSET in phonebook_pull_read Radoslaw Jablonski
@ 2011-02-16 15:00 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-16 15:00 UTC (permalink / raw)
  To: Radoslaw Jablonski; +Cc: linux-bluetooth

Hi Radek,

On Wed, Feb 16, 2011, Radoslaw Jablonski wrote:
> It is needed to properly move starting index in tracker
> for next invocations of phonebook_pull_read - without that
> pull result for bigger queries (over one part of data) will
> be wrong (it will include duplicate vcard entries).
> ---
>  plugins/phonebook-tracker.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)

Pushed upstream. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-16 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16  9:34 [PATCH] Add increasing query OFFSET in phonebook_pull_read Radoslaw Jablonski
2011-02-16 15:00 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox