From 11eef60a5527a2acf066303e8209df6019617fda Mon Sep 17 00:00:00 2001 From: LEDfan Date: Fri, 18 Apr 2014 12:47:44 +0200 Subject: [PATCH 1/4] Implement getSearchProvidder --- appinfo/app.php | 3 ++- lib/addressbook.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/appinfo/app.php b/appinfo/app.php index c36e43df..54008f8c 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -64,7 +64,8 @@ if (\OCP\User::isLoggedIn()) { $addressBooks = $app->getAddressBooksForUser(); foreach ($addressBooks as $addressBook) { if ($addressBook->isActive()) { - \OCP\Contacts::registerAddressBook(new AddressbookProvider($addressBook)); + // $addressBook is instance of \OCA\Contacts\Addressbook + \OCP\Contacts::registerAddressBook($addressBook->getSearchProvider($addressBook)); } } } diff --git a/lib/addressbook.php b/lib/addressbook.php index 0a9cc23a..27eab42b 100644 --- a/lib/addressbook.php +++ b/lib/addressbook.php @@ -482,4 +482,8 @@ class Addressbook extends AbstractPIMCollection { return $events; } + + public function getSearchProvider($addressbook){ + return $this->backend->getSearchProvider($addressbook); + } } From 0d619b835cfca4ed2236c7db33d5220c5023347f Mon Sep 17 00:00:00 2001 From: LEDfan Date: Fri, 18 Apr 2014 12:52:52 +0200 Subject: [PATCH 2/4] Add docs --- lib/addressbook.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/addressbook.php b/lib/addressbook.php index 27eab42b..b4e43eff 100644 --- a/lib/addressbook.php +++ b/lib/addressbook.php @@ -483,6 +483,10 @@ class Addressbook extends AbstractPIMCollection { return $events; } + /** + * Returns the searchProvider for a specific backend. + * @param \OCA\Contacts\Addressbook $addressbook + */ public function getSearchProvider($addressbook){ return $this->backend->getSearchProvider($addressbook); } From cc3fc4b9ba39f5d1daf87816d035362df19e6bea Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Wed, 23 Apr 2014 08:35:28 +0200 Subject: [PATCH 3/4] Fix #474 isssue 2 --- lib/backend/localusers.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/backend/localusers.php b/lib/backend/localusers.php index 5d312787..e06869a9 100644 --- a/lib/backend/localusers.php +++ b/lib/backend/localusers.php @@ -217,7 +217,6 @@ class LocalUsers extends AbstractBackend { // All done // now update the index table with all the properties $this->updateIndex($user, $vcard); - return true; } } catch(\Exception $e) { \OCP\Util::writeLog('contacts', __METHOD__.' exception: ' @@ -225,6 +224,7 @@ class LocalUsers extends AbstractBackend { return false; } } + return true; } /** @@ -244,8 +244,6 @@ class LocalUsers extends AbstractBackend { \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); return false; - } else { - return true; } } catch(\Exception $e) { \OCP\Util::writeLog('contacts', __METHOD__.' exception: ' From c03ad310cbf40c574479c2fc8b87412a0c41d659 Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Wed, 23 Apr 2014 08:42:17 +0200 Subject: [PATCH 4/4] fix issues --- appinfo/app.php | 3 +-- lib/addressbook.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index 54008f8c..775f6ab8 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -64,8 +64,7 @@ if (\OCP\User::isLoggedIn()) { $addressBooks = $app->getAddressBooksForUser(); foreach ($addressBooks as $addressBook) { if ($addressBook->isActive()) { - // $addressBook is instance of \OCA\Contacts\Addressbook - \OCP\Contacts::registerAddressBook($addressBook->getSearchProvider($addressBook)); + \OCP\Contacts::registerAddressBook($addressBook->getSearchProvider()); } } } diff --git a/lib/addressbook.php b/lib/addressbook.php index b4e43eff..c4984839 100644 --- a/lib/addressbook.php +++ b/lib/addressbook.php @@ -487,7 +487,7 @@ class Addressbook extends AbstractPIMCollection { * Returns the searchProvider for a specific backend. * @param \OCA\Contacts\Addressbook $addressbook */ - public function getSearchProvider($addressbook){ - return $this->backend->getSearchProvider($addressbook); + public function getSearchProvider(){ + return $this->backend->getSearchProvider($this); } }