Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117819421
D4570.1775291928.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D4570.1775291928.diff
View Options
diff --git a/lib/kolab_sync_data_calendar.php b/lib/kolab_sync_data_calendar.php
--- a/lib/kolab_sync_data_calendar.php
+++ b/lib/kolab_sync_data_calendar.php
@@ -803,21 +803,86 @@
throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::INVALID_REQUEST);
}
- if ($event['free_busy']) {
- $old['free_busy'] = $event['free_busy'];
+ // A single recurring event occurrence
+ if (!empty($event['recurrence_date'])) {
+ $event['recurrence'] = [];
+
+ // A cancellation
+ if (($event['_method'] ?? '') == 'CANCEL' || ($event['status'] ?? '') == 'CANCELLED') {
+ // remove the matching RDATE entry
+ if (!empty($old['recurrence']['RDATE'])) {
+ foreach ($old['recurrence']['RDATE'] as $j => $rdate) {
+ if ($rdate->format('Ymd') == $event['start']->format('Ymd')) {
+ unset($old['recurrence']['RDATE'][$j]);
+ break;
+ }
+ }
+ }
+
+ // add exception to master event
+ $old['recurrence']['EXDATE'][] = $event['start'];
+ }
+ else {
+ if ($status) {
+ $this->update_attendee_status($event, $status);
+ $status = null;
+ }
+
+ if (!isset($old['exceptions'])) {
+ if (isset($old['recurrence']['EXCEPTIONS'])) {
+ $old['exceptions'] = &$old['recurrence']['EXCEPTIONS'];
+ }
+ else {
+ $old['exceptions'] = [];
+ }
+ }
+
+ $existing = false;
+ foreach ($old['exceptions'] as $i => $exception) {
+ if (libcalendaring::is_recurrence_exception($event, $exception)) {
+ $old['exceptions'][$i] = $event;
+ $existing = true;
+ }
+ }
+
+ if (!$existing) {
+ $old['exceptions'][] = $event;
+ }
+ }
+ }
+ // User accepted an event cancellation
+ else if (($event['_method'] ?? '') == 'CANCEL' || ($event['status'] ?? '') == 'CANCELLED') {
+ // FIXME: What should happen when user declined a cancellation?
+ $old['status'] = 'CANCELLED';
+ // FIXME: Should we still update the attendee status at all? Maybe force CANCELLED?
+ $status = null;
+ // FIXME: We probably should just delete the event. Some clients do not handle cancelled status
+ // properly (maybe it's our fault?).
+ }
+ // A main event update
+ else if (isset($event['sequence']) && $event['sequence'] > $old['sequence']) {
+ // FIXME: Can we be smarter here? Should we update everything? What about e.g. new attendees?
+ // And do we need to check the sequence?
+ $props = ['start', 'end', 'title', 'description', 'location', 'free_busy'];
+
+ foreach ($props as $prop) {
+ if (isset($event[$prop])) {
+ $old[$prop] = $event[$prop];
+ }
+ }
+
+ // Copy new custom properties
+ if (!empty($event['x-custom'])) {
+ foreach ($event['x-custom'] as $key => $val) {
+ $old['x-custom'][$key] = $val;
+ }
+ }
}
// Updating an existing event is most-likely a response
// to an iTip request with bumped SEQUENCE
$old['sequence'] += 1;
- // Copy new custom properties
- if (!empty($event['x-custom'])) {
- foreach ($event['x-custom'] as $key => $val) {
- $old['x-custom'][$key] = $val;
- }
- }
-
// Update the event
return $this->save_event($old, $status);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 8:38 AM (40 m, 59 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18828677
Default Alt Text
D4570.1775291928.diff (3 KB)
Attached To
Mode
D4570: MeetingResponse and MeetingRequest fixes
Attached
Detach File
Event Timeline