Skip to content

Commit

Permalink
Correctly deal with cancelled meetings via ActiveSync.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Dec 2, 2015
1 parent a864fa0 commit cb83b21
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions kronolith/lib/Event.php
Expand Up @@ -1498,28 +1498,33 @@ public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
$this->private = ($message->getSensitivity() == Horde_ActiveSync_Message_Appointment::SENSITIVITY_PRIVATE || $message->getSensitivity() == Horde_ActiveSync_Message_Appointment::SENSITIVITY_CONFIDENTIAL) ? true : false;

/* Busy Status */
$status = $message->getBusyStatus();
switch ($status) {
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_BUSY:
$status = Kronolith::STATUS_CONFIRMED;
break;
if ($message->getMeetingStatus() == Horde_ActiveSync_Message_Appointment::MEETING_CANCELLED) {
$status = Kronolith::STATUS_CANCELLED;
} else {
$status = $message->getBusyStatus();
switch ($status) {
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_BUSY:
$status = Kronolith::STATUS_CONFIRMED;
break;

case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_FREE:
$status = Kronolith::STATUS_FREE;
break;
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_FREE:
$status = Kronolith::STATUS_FREE;
break;

case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_TENTATIVE:
$status = Kronolith::STATUS_TENTATIVE;
break;
// @TODO: not sure how "Out" should show in kronolith...
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_OUT:
$status = Kronolith::STATUS_CONFIRMED;
default:
// EAS Specifies default should be free.
$status = Kronolith::STATUS_FREE;
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_TENTATIVE:
$status = Kronolith::STATUS_TENTATIVE;
break;
// @TODO: not sure how "Out" should show in kronolith...
case Horde_ActiveSync_Message_Appointment::BUSYSTATUS_OUT:
$status = Kronolith::STATUS_CONFIRMED;
default:
// EAS Specifies default should be free.
$status = Kronolith::STATUS_FREE;
}
}
$this->status = $status;


/* Alarm */
if ($alarm = $message->getReminder()) {
$this->alarm = $alarm;
Expand Down Expand Up @@ -1821,7 +1826,11 @@ public function toASAppointment(array $options = array())

// Attendees
if (!$this->isPrivate() && count($this->attendees)) {
$message->setMeetingStatus(Horde_ActiveSync_Message_Appointment::MEETING_IS_MEETING);
$message->setMeetingStatus(
$this->status == Kronolith::STATUS_CANCELLED
? Horde_ActiveSync_Message_Appointment::MEETING_CANCELLED
: Horde_ActiveSync_Message_Appointment::MEETING_IS_MEETING
);
foreach ($this->attendees as $email => $properties) {
$attendee = new Horde_ActiveSync_Message_Attendee(array(
'protocolversion' => $options['protocolversion']));
Expand Down Expand Up @@ -1855,6 +1864,8 @@ public function toASAppointment(array $options = array())

$message->addAttendee($attendee);
}
} elseif ($this->status == Kronolith::STATUS_CANCELLED) {
$message->setMeetingStatus(Horde_ActiveSync_Message_Appointment::MEETING_CANCELLED);
} else {
$message->setMeetingStatus(Horde_ActiveSync_Message_Appointment::MEETING_NOT_MEETING);
}
Expand Down

0 comments on commit cb83b21

Please sign in to comment.