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 @@ -116,8 +116,7 @@ const SENSITIVITY_PRIVATE = 2; const SENSITIVITY_CONFIDENTIAL = 3; - const KEY_DTSTAMP = 'x-custom.X-ACTIVESYNC-DTSTAMP'; - const KEY_RESPONSE_DTSTAMP = 'x-custom.X-ACTIVESYNC-RESPONSE-DTSTAMP'; + const KEY_DTSTAMP = 'x-custom.X-ACTIVESYNC-DTSTAMP'; /** * Mapping of attendee status @@ -507,10 +506,10 @@ } // Attendees - // Outlook 2013 sends a dummy update just after MeetingResponse has been processed, - // this update resets attendee status set in the MeetingResponse request. - // We ignore changes to attendees data on such updates - if ($is_outlook && $this->isDummyOutlookUpdate($data, $entry, $event)) { + // Whenever Outlook sends dummy timezone it is an event where the user is an attendee. + // In these cases Attendees element is bogus: contains invalid status and does not + // contain all attendees. We have to ignore it. + if ($is_outlook && $data->timezone === $dummy_tz) { $this->logger->debug('Dummy outlook update detected, ignoring attendee changes.'); $attendees = $entry['attendees']; } @@ -593,7 +592,6 @@ } $event['attendees'] = $attendees; - $event['categories'] = $categories; $event['exceptions'] = isset($event['recurrence']['EXCEPTIONS']) ? $event['recurrence']['EXCEPTIONS'] : array(); @@ -664,10 +662,6 @@ // Update/Save the event if (empty($existing)) { - if ($dtstamp) { - $this->setKolabDataItem($event, self::KEY_RESPONSE_DTSTAMP, $dtstamp); - } - $folder = $this->save_event($event, $status); // Create SyncState for the new event, so it is not synced twice @@ -695,10 +689,6 @@ } } else { - if ($dtstamp) { - $this->setKolabDataItem($existing, self::KEY_RESPONSE_DTSTAMP, $dtstamp); - } - $folder = $this->update_event($event, $existing, $status, $request->instanceId); } @@ -1127,39 +1117,4 @@ return $rec; } - - /** - * Check if the event update request is a fake (for Outlook) - */ - protected function isDummyOutlookUpdate($data, $entry, &$result) - { - $is_dummy = false; - - // Outlook 2013 sends a dummy update just after MeetingResponse has been processed, - // this update resets attendee status set in the MeetingResponse request. - // We ignore attendees data in such updates, they should not happen according to - // https://msdn.microsoft.com/en-us/library/office/hh428685(v=exchg.140).aspx - // but they will contain some data as alarms and free/busy status so we don't - // ignore them completely - if (!empty($entry) && !empty($data->attendees) && stripos($this->device->devicetype, 'outlook') !== false) { - // Some of these requests use just dummy Timezone - $dummy_tz = str_repeat('A', 230) . '=='; - - if ($data->timezone == $dummy_tz) { - $is_dummy = true; - } - - // But some of them do not, so we have check if that is a first - // update immediately (up to 5 seconds) after MeetingResponse request - if (!$is_dummy && ($dtstamp = $this->getKolabDataItem($entry, self::KEY_RESPONSE_DTSTAMP))) { - $dtstamp = new DateTime($dtstamp); - $now = new DateTime('now', new DateTimeZone('UTC')); - $is_dummy = $now->getTimestamp() - $dtstamp->getTimestamp() <= 5; - } - - $this->unsetKolabDataItem($result, self::KEY_RESPONSE_DTSTAMP); - } - - return $is_dummy; - } }