From 5c43d6713b24e904bec175f02aeff82025c2d0f0 Mon Sep 17 00:00:00 2001 From: Bartosz Szatkowski Date: Tue, 5 Jul 2011 22:53:20 +0200 Subject: [PATCH] obexd: Add checking ebook availability before processing Some ebooks may be offline due to lack of internet connection or it may require prior authorizations. --- obexd/plugins/phonebook-ebook.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c index 9c5586004..97785b569 100644 --- a/obexd/plugins/phonebook-ebook.c +++ b/obexd/plugins/phonebook-ebook.c @@ -561,10 +561,12 @@ int phonebook_pull_read(void *request) ebook = ebooks; while (ebook != NULL) { - ret = e_book_get_contacts_async(ebook->data, data->query, - ebookpull_cb, data); - if (ret == TRUE) - data->queued_calls++; + if (e_book_is_opened(ebook->data) == TRUE) { + ret = e_book_get_contacts_async(ebook->data, + data->query, ebookpull_cb, data); + if (ret == TRUE) + data->queued_calls++; + } ebook = ebook->next; } @@ -591,10 +593,12 @@ void *phonebook_get_entry(const char *folder, const char *id, ebook = ebooks; while (ebook != NULL) { - ret = e_book_get_contact_async(ebook->data, data->id, + if (e_book_is_opened(ebook->data) == TRUE) { + ret = e_book_get_contact_async(ebook->data, data->id, ebook_entry_cb, data); - if (ret == TRUE) - data->queued_calls++; + if (ret == TRUE) + data->queued_calls++; + } ebook = ebook->next; } @@ -632,10 +636,12 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, ebook = ebooks; while (ebook != NULL) { - ret = e_book_get_contacts_async(ebook->data, query, - cache_cb, data); - if (ret == TRUE) - data->queued_calls++; + if (e_book_is_opened(ebook->data) == TRUE) { + ret = e_book_get_contacts_async(ebook->data, query, + cache_cb, data); + if (ret == TRUE) + data->queued_calls++; + } ebook = ebook->next; } -- 2.47.3