diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2014-01-07 10:48:26 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2014-01-07 15:40:26 (GMT) |
commit | 13b1c30d140314ebc2379e26b35fa8e7bacd67e8 (patch) | |
tree | ab11403bac4e8f3c60ebf3db4b0e8f5e08c69e7f | |
parent | 490dada1594a8b29f7b586ac5f6f61998fc4be10 (diff) | |
download | iRony-13b1c30d140314ebc2379e26b35fa8e7bacd67e8.tar.gz |
Ignore IMAP subscriptions when accessing a folder directly via UID/Name (#2701)
-rw-r--r-- | lib/Kolab/CalDAV/CalendarBackend.php | 10 | ||||
-rw-r--r-- | lib/Kolab/CardDAV/ContactsBackend.php | 10 | ||||
-rw-r--r-- | lib/Kolab/Utils/DAVBackend.php | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/Kolab/CalDAV/CalendarBackend.php b/lib/Kolab/CalDAV/CalendarBackend.php index 17eba73..213dbea 100644 --- a/lib/Kolab/CalDAV/CalendarBackend.php +++ b/lib/Kolab/CalDAV/CalendarBackend.php @@ -48,6 +48,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend private $aliases; private $useragent; private $type_component_map = array('event' => 'VEVENT', 'task' => 'VTODO'); + private $subscribed = null; /** * Read available calendar folders from server @@ -59,7 +60,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend return $this->calendars; // get all folders that have "event" type - $folders = array_merge(kolab_storage::get_folders('event'), kolab_storage::get_folders('task')); + $folders = array_merge(kolab_storage::get_folders('event', $this->subscribed), kolab_storage::get_folders('task', $this->subscribed)); $this->calendars = $this->folders = $this->aliases = array(); foreach (kolab_storage::sort_folders($folders) as $folder) { @@ -164,6 +165,13 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend $this->calendars[$id]['principaluri'] = 'principals/' . HTTPBasic::$current_user; } + // retry with subscribed = false (#2701) + if (empty($this->calendars[$id]) && $this->subscribed === null && rcube::get_instance()->config->get('kolab_use_subscriptions')) { + $this->subscribed = false; + unset($this->calendars); + return $this->getCalendarByName($calendarUri); + } + return $this->calendars[$id]; } diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php index 0a342da..45ba54b 100644 --- a/lib/Kolab/CardDAV/ContactsBackend.php +++ b/lib/Kolab/CardDAV/ContactsBackend.php @@ -43,6 +43,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend private $folders; private $aliases; private $useragent; + private $subscribed = null; /** @@ -55,7 +56,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend return $this->sources; // get all folders that have "contact" type - $folders = kolab_storage::get_folders('contact'); + $folders = kolab_storage::get_folders('contact', $this->subscribed); $this->sources = $this->folders = $this->aliases = array(); foreach (kolab_storage::sort_folders($folders) as $folder) { @@ -164,6 +165,13 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend $id = $this->aliases[$addressBookUri]; } + // retry with subscribed = false (#2701) + if (empty($this->sources[$id]) && $this->subscribed === null && rcube::get_instance()->config->get('kolab_use_subscriptions')) { + $this->subscribed = false; + unset($this->sources); + return $this->getAddressBookByName($addressBookUri); + } + return $this->sources[$id]; } diff --git a/lib/Kolab/Utils/DAVBackend.php b/lib/Kolab/Utils/DAVBackend.php index 098a353..4de51ad 100644 --- a/lib/Kolab/Utils/DAVBackend.php +++ b/lib/Kolab/Utils/DAVBackend.php @@ -46,7 +46,7 @@ class DAVBackend */ public static function get_storage_folder($uid, $type) { - foreach (kolab_storage::get_folders($type) as $folder) { + foreach (kolab_storage::get_folders($type, false) as $folder) { if (self::get_uid($folder) == $uid) return $folder; } |