Changeset View
Changeset View
Standalone View
Standalone View
lib/kolab_sync_data_calendar.php
Show First 20 Lines • Show All 590 Lines • ▼ Show 20 Lines | public function setAttendeeStatus(Syncroton_Model_MeetingResponse $request) | ||||
3 => 'DECLINED', | 3 => 'DECLINED', | ||||
); | ); | ||||
if ($status = $status_map[$request->userResponse]) { | if ($status = $status_map[$request->userResponse]) { | ||||
// extract event data from the invitation | // extract event data from the invitation | ||||
$event = $this->get_event_from_invitation($request); | $event = $this->get_event_from_invitation($request); | ||||
// find the event in calendar | // find the event in calendar | ||||
if (array_key_exists('uid', $event)) { | |||||
$existing = $this->find_event_by_uid($event['uid']); | $existing = $this->find_event_by_uid($event['uid']); | ||||
} else { | |||||
$existing = $this->find_event_by_uid($event->uID); | |||||
} | |||||
/* | /* | ||||
switch ($status) { | switch ($status) { | ||||
case 'ACCEPTED': $event['free_busy'] = 'busy'; break; | case 'ACCEPTED': $event['free_busy'] = 'busy'; break; | ||||
case 'TENTATIVE': $event['free_busy'] = 'tentative'; break; | case 'TENTATIVE': $event['free_busy'] = 'tentative'; break; | ||||
case 'DECLINED': $event['free_busy'] = 'free'; break; | case 'DECLINED': $event['free_busy'] = 'free'; break; | ||||
} | } | ||||
*/ | */ | ||||
// Store Outlook response timestamp for further use | // Store Outlook response timestamp for further use | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | */ | ||||
// TODO: Activesync >= 16.1 proposedStartTime and proposedEndTime. | // TODO: Activesync >= 16.1 proposedStartTime and proposedEndTime. | ||||
} | } | ||||
} | } | ||||
// FIXME: We should not return an UID when status=DECLINED | // FIXME: We should not return an UID when status=DECLINED | ||||
// as it's expected by the specification. Server | // as it's expected by the specification. Server | ||||
// should delete an event in such a case, but we | // should delete an event in such a case, but we | ||||
// keep the event copy with appropriate attendee status instead. | // keep the event copy with appropriate attendee status instead. | ||||
return empty($status) ? null : $this->serverId($event['uid'], $folder); | return empty($status) ? null : ( | ||||
array_key_exists('uid', $event) ? | |||||
$this->serverId($event['uid'], $folder) : | |||||
$this->serverId($event->uID, $folder) | |||||
); | |||||
} | } | ||||
/** | /** | ||||
* Get an event from the invitation email | * Get an event from the invitation email | ||||
*/ | */ | ||||
protected function get_event_from_invitation(Syncroton_Model_MeetingResponse $request) | protected function get_event_from_invitation(Syncroton_Model_MeetingResponse $request) | ||||
{ | { | ||||
// Limitations: | // Limitations: | ||||
// 1. The meeting request may be in an iTip or the calendar event | // 1. The meeting request may be in an iTip or the calendar event | ||||
// For now we support iTips only here | // For now we support iTips only here | ||||
// 2. LongId might be used instead of RequestId, this is not supported | // 2. LongId might be used instead of RequestId, this is not supported | ||||
if ($request->requestId) { | if ($request->requestId) { | ||||
$mail_class = new kolab_sync_data_email($this->device, $this->syncTimeStamp); | $mail_class = new kolab_sync_data_email($this->device, $this->syncTimeStamp); | ||||
if ($event = $mail_class->get_invitation_event($request->requestId)) { | if ($event = $mail_class->get_invitation_event($request->requestId)) { | ||||
return $event; | return $event; | ||||
} | } | ||||
$collection = new Syncroton_Model_SyncCollection( | |||||
array('collectionId' => $request->collectionId) | |||||
); | |||||
if ($event = $this->getEntry($collection, $request->requestId)) { | |||||
return $event; | |||||
} | |||||
throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::INVALID_REQUEST); | throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::INVALID_REQUEST); | ||||
} | } | ||||
throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::MEETING_ERROR); | throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::MEETING_ERROR); | ||||
} | } | ||||
/** | /** | ||||
* Find the Kolab event in any (of subscribed personal calendars) folder | * Find the Kolab event in any (of subscribed personal calendars) folder | ||||
Show All 23 Lines | */ | ||||
{ | { | ||||
// TODO: instanceId - DateTime - of the exception to be processed, if not set process all occurrences | // TODO: instanceId - DateTime - of the exception to be processed, if not set process all occurrences | ||||
if ($instanceId) { | if ($instanceId) { | ||||
throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::INVALID_REQUEST); | throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::INVALID_REQUEST); | ||||
} | } | ||||
$this->update_attendee_status($old, $status); | $this->update_attendee_status($old, $status); | ||||
if (array_key_exists('free_busy', $event)) { | |||||
if ($event['free_busy']) { | if ($event['free_busy']) { | ||||
$old['free_busy'] = $event['free_busy']; | $old['free_busy'] = $event['free_busy']; | ||||
} | } | ||||
} | |||||
// Updating an existing event is most-likely a response | // Updating an existing event is most-likely a response | ||||
// to an iTip request with bumped SEQUENCE | // to an iTip request with bumped SEQUENCE | ||||
$old['sequence'] += 1; | $old['sequence'] += 1; | ||||
// TODO: Free/busy trigger? | // TODO: Free/busy trigger? | ||||
// Update the event | // Update the event | ||||
▲ Show 20 Lines • Show All 357 Lines • Show Last 20 Lines |