diff options
author | Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com> | 2011-02-14 11:19:48 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-02-15 11:18:55 -0300 |
commit | 0c8b5836d46b0ef3f6412a159078ca9c797914f8 (patch) | |
tree | 494f26eb8c603c874ccc8f417aee8387ec9112e2 /plugins/phonebook-tracker.c | |
parent | 371cf57a3a933e349936d67fda85cecede6fba0c (diff) | |
download | obexd-0c8b5836d46b0ef3f6412a159078ca9c797914f8.tar.gz |
Support for stop fetching data when maxlistcount is achieved
When desired number of results has been already processed,
then sending already collected data and stopping fetching
more results from tracker (previously in this scenario
unnecessarily processing data continued untill end of results
in db)
Diffstat (limited to 'plugins/phonebook-tracker.c')
-rw-r--r-- | plugins/phonebook-tracker.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c index c80ee68..210799d 100644 --- a/plugins/phonebook-tracker.c +++ b/plugins/phonebook-tracker.c @@ -1602,11 +1602,17 @@ static int pull_contacts(const char **reply, int num_fields, void *user_data) last_index = params->liststartoffset + params->maxlistcount; - if ((data->index <= params->liststartoffset || - data->index > last_index) && - params->maxlistcount > 0) + if (data->index <= params->liststartoffset) return 0; + /* max number of results achieved - need send vcards data that was + * already collected and stop further data processing (these operations + * will be invoked in "done" section) */ + if (data->index > last_index && params->maxlistcount > 0) { + DBG("Maxlistcount achieved"); + goto done; + } + add_entry: contact = g_new0(struct phonebook_contact, 1); contact_init(contact, reply); |