linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Szatkowski <bulislaw@linux.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bartosz Szatkowski <bulislaw@linux.com>
Subject: [PATCH obexd 3/5] Add checking ebook availability before processing
Date: Mon,  4 Jul 2011 23:51:39 +0200	[thread overview]
Message-ID: <1309816301-18377-3-git-send-email-bulislaw@linux.com> (raw)
In-Reply-To: <1309816301-18377-1-git-send-email-bulislaw@linux.com>

Some ebooks may be offline due to lack of internet connection or it may
require prior authorizations.
---
 plugins/phonebook-ebook.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index dc78d17..54b764b 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -545,10 +545,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;
 	}
@@ -575,10 +577,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;
 	}
@@ -616,10 +620,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;
 	}
-- 
1.7.5.3


  parent reply	other threads:[~2011-07-04 21:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 21:51 [PATCH obexd 1/5] Change EDS backend to support multiple ebooks Bartosz Szatkowski
2011-07-04 21:51 ` [PATCH obexd 2/5] Add constraint on pulled path Bartosz Szatkowski
2011-07-04 21:51 ` Bartosz Szatkowski [this message]
2011-07-04 21:51 ` [PATCH obexd 4/5] Add 0.vcf (me contact) when generating cache Bartosz Szatkowski
2011-07-04 21:51 ` [PATCH obexd 5/5] Add proper finishing/canceling requests Bartosz Szatkowski
2011-07-05  8:45 ` [PATCH obexd 1/5] Change EDS backend to support multiple ebooks Luiz Augusto von Dentz
2011-07-05  9:00   ` Bartosz Szatkowski
2011-07-05  9:58     ` Luiz Augusto von Dentz
2011-07-05 10:07       ` Bartosz Szatkowski
2011-07-05 10:13         ` Luiz Augusto von Dentz
2011-07-05 10:30           ` Bartosz Szatkowski
2011-07-05 10:33             ` Luiz Augusto von Dentz
2011-07-05 11:40               ` Bartosz Szatkowski

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=1309816301-18377-3-git-send-email-bulislaw@linux.com \
    --to=bulislaw@linux.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).