diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2014-12-23 16:09:28 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2014-12-23 16:09:28 (GMT) |
commit | 2a123ba4561bafc8a91ab3eff1e666287a3be5fa (patch) | |
tree | dd60d8c1508e7d31304c1e62dcdb6921b3dbe8a8 | |
parent | b81422089672aa74646c9c9cd0b751cfdf569cca (diff) | |
download | iRony-2a123ba4561bafc8a91ab3eff1e666287a3be5fa.tar.gz |
Set folder type according to the submitted supported-calendar-component-set property (#4129)
-rw-r--r-- | lib/Kolab/CalDAV/CalendarBackend.php | 3 | ||||
-rw-r--r-- | lib/Kolab/Utils/DAVBackend.php | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Kolab/CalDAV/CalendarBackend.php b/lib/Kolab/CalDAV/CalendarBackend.php index e6d0c42..fab0236 100644 --- a/lib/Kolab/CalDAV/CalendarBackend.php +++ b/lib/Kolab/CalDAV/CalendarBackend.php @@ -47,7 +47,6 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend private $folders; private $aliases; private $useragent; - private $type_component_map = array('event' => 'VEVENT', 'task' => 'VTODO'); private $subscribed = null; /** @@ -73,7 +72,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend '{DAV:}displayname' => html_entity_decode($folder->get_name(), ENT_COMPAT, RCUBE_CHARSET), '{http://apple.com/ns/ical/}calendar-color' => '#' . $folder->get_color('FF0000') . 'FF', '{http://calendarserver.org/ns/}getctag' => sprintf('%d-%d-%d', $fdata['UIDVALIDITY'], $fdata['HIGHESTMODSEQ'], $fdata['UIDNEXT']), - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Property\SupportedCalendarComponentSet(array($this->type_component_map[$folder->type])), + '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Property\SupportedCalendarComponentSet(array(DAVBackend::$caldav_type_component_map[$folder->type])), '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Property\ScheduleCalendarTransp('opaque'), ); $this->aliases[$folder->name] = $id; diff --git a/lib/Kolab/Utils/DAVBackend.php b/lib/Kolab/Utils/DAVBackend.php index 9cc434b..41c1997 100644 --- a/lib/Kolab/Utils/DAVBackend.php +++ b/lib/Kolab/Utils/DAVBackend.php @@ -37,6 +37,8 @@ class DAVBackend const IMAP_UID_KEY_PRIVATE = '/private/vendor/kolab/uniqueid'; const IMAP_UID_KEY_CYRUS = '/shared/vendor/cmu/cyrus-imapd/uniqueid'; + public static $caldav_type_component_map = array('event' => 'VEVENT', 'task' => 'VTODO'); + /** * Getter for a kolab_storage_folder with the given UID * @@ -230,6 +232,14 @@ class DAVBackend $props['color'] = substr(trim($val, '#'), 0, 6); break; + case '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': + $type_map = array_flip(self::$caldav_type_component_map); + $comp_types = $val->getValue(); + $comp_type = $comp_types[0]; + if (!empty($type_map[$comp_type])) + $props['type'] = $type = $type_map[$comp_type]; + break; + case '{urn:ietf:params:xml:ns:caldav}calendar-description': default: // unsupported property |