1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Contacts: Convinience method for getting backend in carddav.

This commit is contained in:
Thomas Tanghus 2013-03-11 16:22:27 +01:00
parent 052db9fd1d
commit 29dc6cf0b0

View File

@ -145,7 +145,8 @@ class Backend extends \Sabre_CardDAV_Backend_Abstract {
* @return void * @return void
*/ */
public function deleteAddressBook($addressbookid) { public function deleteAddressBook($addressbookid) {
$this->backend->deleteAddressBook($addressbookid); $backend = $this->getBackendForAddressBook($addressbookid);
$backend->deleteAddressBook($addressbookid);
} }
/** /**
@ -156,11 +157,9 @@ class Backend extends \Sabre_CardDAV_Backend_Abstract {
*/ */
public function getCards($addressbookid) { public function getCards($addressbookid) {
$contacts = array(); $contacts = array();
foreach($this->backends as $backend) { $backend = $this->getBackendForAddressBook($addressbookid);
if($backend->hasAddressBook($addressbookid)) { $contacts = $backend->getContacts($addressbookid);
$contacts = $backend->getContacts($addressbookid);
}
}
$cards = array(); $cards = array();
foreach($contacts as $contact) { foreach($contacts as $contact) {
//OCP\Util::writeLog('contacts', __METHOD__.', uri: ' . $i['uri'], OCP\Util::DEBUG); //OCP\Util::writeLog('contacts', __METHOD__.', uri: ' . $i['uri'], OCP\Util::DEBUG);
@ -184,6 +183,7 @@ class Backend extends \Sabre_CardDAV_Backend_Abstract {
* @return array * @return array
*/ */
public function getCard($addressbookid, $carduri) { public function getCard($addressbookid, $carduri) {
$backend = $this->getBackendForAddressBook($addressbookid);
return Contacts\VCard::findWhereDAVDataIs($addressbookid, $carduri); return Contacts\VCard::findWhereDAVDataIs($addressbookid, $carduri);
} }