summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-03-28 17:11:03 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-03-28 17:11:03 (GMT)
commitfa401147bb842f8cdc1d55ffb28bdc489a61bbfa (patch)
tree7fde4174e00f50da89681f4203a45da0d0e86586
parent44ebf31c47b5f66ba6da1720948cee01d6f89ccd (diff)
downloadiRony-fa401147bb842f8cdc1d55ffb28bdc489a61bbfa.tar.gz
Use display name provided by libkolab/kolab_storage
-rw-r--r--lib/Kolab/CalDAV/CalendarBackend.php33
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php2
2 files changed, 14 insertions, 21 deletions
diff --git a/lib/Kolab/CalDAV/CalendarBackend.php b/lib/Kolab/CalDAV/CalendarBackend.php
index 72e8a7a..fab4cd8 100644
--- a/lib/Kolab/CalDAV/CalendarBackend.php
+++ b/lib/Kolab/CalDAV/CalendarBackend.php
@@ -63,7 +63,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$names = array();
foreach ($folders as $folder) {
$folders[$folder->name] = $folder;
- $names[$folder->name] = rcube_charset::convert($folder->name, 'UTF7-IMAP');
+ $names[$folder->name] = html_entity_decode($folder->get_name(), ENT_COMPAT, RCUBE_CHARSET); // decode &raquo;
}
asort($names, SORT_LOCALE_STRING);
@@ -76,7 +76,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
'id' => $id,
'uri' => $id,
'{DAV:}displayname' => $name,
- '{http://apple.com/ns/ical/}calendar-color' => $this->get_color($folders[$utf7name]),
+ '{http://apple.com/ns/ical/}calendar-color' => $folder->get_color(),
'{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('VEVENT')),
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Property\ScheduleCalendarTransp('opaque'),
@@ -117,20 +117,6 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
}
/**
- * Helper method to extract calendar color from metadata
- */
- private function get_color($folder)
- {
- // color is defined in folder METADATA
- $metadata = $folder->get_metadata(array(kolab_storage::COLOR_KEY_PRIVATE, kolab_storage::COLOR_KEY_SHARED));
- if (($color = $metadata[kolab_storage::COLOR_KEY_PRIVATE]) || ($color = $metadata[kolab_storage::COLOR_KEY_SHARED])) {
- return '#' . $color;
- }
-
- return '';
- }
-
- /**
* Returns a list of calendars for a principal.
*
* Every calendars is an array with the following keys:
@@ -216,6 +202,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$props['color'] = substr(trim($val, '#'), 0, 6);
break;
+ case '{urn:ietf:params:xml:ns:caldav}calendar-description':
default:
// unsupported property
}
@@ -291,15 +278,16 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$updates['parent'] = join('/', $parts);
}
else {
+ //$updates['displayname'] = $val;
$errors[403][$prop] = null;
}
break;
case '{http://apple.com/ns/ical/}calendar-color':
- $updates['oldname'] = $folder->name;
$updates['color'] = substr(trim($val, '#'), 0, 6);
break;
+ case '{urn:ietf:params:xml:ns:caldav}calendar-description':
default:
// unsupported property
$errors[403][$prop] = null;
@@ -308,11 +296,12 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
// execute folder update
if (!empty($updates)) {
- // 'name' and 'parent' properties are alwas required
+ // 'name' and 'parent' properties are always required
if (empty($updates['name'])) {
$parts = explode('/', $folder->name);
$updates['name'] = rcube_charset::convert(array_pop($parts), 'UTF7-IMAP');
$updates['parent'] = join('/', $parts);
+ $updates['oldname'] = $folder->name;
}
if (!kolab_storage::folder_update($updates)) {
@@ -542,6 +531,8 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$object[$key] = $val;
}
+ // TODO: remove attachments not listed anymore
+
// save object
$saved = $storage->save($object, 'event', $uid);
if (!$saved) {
@@ -835,7 +826,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$attendee['status'] = 'ACCEPTED';
$event['organizer'] = $attendee;
}
- else {
+ else if ($attendee['email'] != $event['organizer']['email']) {
$event['attendees'][] = $attendee;
}
break;
@@ -971,11 +962,13 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
}
if ($event['organizer']) {
- unset($event['organizer']['rsvp']);
+ unset($event['organizer']['rsvp'], $event['organizer']['role']);
$ve->add('ORGANIZER', 'mailto:' . $event['organizer']['email'], VObjectUtils::map_keys($event['organizer'], $this->attendee_keymap));
}
foreach ((array)$event['attendees'] as $attendee) {
+ if ($event['organizer'] && $attendee['role'] == 'ORGANIZER')
+ continue;
$attendee['rsvp'] = $attendee['rsvp'] ? 'TRUE' : null;
$ve->add('ATTENDEE', 'mailto:' . $attendee['email'], VObjectUtils::map_keys($attendee, $this->attendee_keymap));
}
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index 97242a0..08983de 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -61,7 +61,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
$names = array();
foreach ($folders as $folder) {
$folders[$folder->name] = $folder;
- $names[$folder->name] = rcube_charset::convert($folder->name, 'UTF7-IMAP');
+ $names[$folder->name] = html_entity_decode($folder->get_name(), ENT_COMPAT, RCUBE_CHARSET);
}
asort($names, SORT_LOCALE_STRING);