set the activesync MEETINGSTATUS property accordingly.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 10 Apr 2010 16:10:16 +0000 (12:10 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 10 Apr 2010 16:10:16 +0000 (12:10 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Message/Appointment.php
kronolith/lib/Event.php

index dcabbbd..1b9cde5 100644 (file)
@@ -400,7 +400,6 @@ class Horde_ActiveSync_Message_Appointment extends Horde_ActiveSync_Message_Base
             $rrule->setRecurType(Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY);
             $rrule->setRecurOnDay($recurrence->dayofweek);
             break;
-        /* TODO: Not sure about these 'Nth' rules - might need more eyes */
         case Horde_ActiveSync_Message_Recurrence::TYPE_YEARLY:
             $rrule->setRecurType(Horde_Date_Recurrence::RECUR_YEARLY_DATE);
             break;
@@ -636,55 +635,21 @@ class Horde_ActiveSync_Message_Appointment extends Horde_ActiveSync_Message_Base
      * Set the status for this appointment. Should be one of:
      *   none, meeting, received, canceled, canceledreceived.
      *
-     * TODO: Not really sure about when these would be used.
-     *
-     *
-     * @param <type> $status
+     * @param integer $status  A MEETING_* constant
      */
     public function setMeetingStatus($status)
     {
-        switch ($status) {
-        case 'none':
-            $status = self::MEETING_NOT_MEETING;
-            break;
-        case 'meeting':
-            $status = self::MEETING_IS_MEETING;
-            break;
-        case 'received':
-            $status = self::MEETING_RECEIVED;
-            break;
-        case 'canceled':
-            $status = self::MEETING_CANCELLED;
-            break;
-        default:
-            return;
-        }
 
         $this->_properties['meetingstatus'] = $status;
     }
 
     /**
      *
-     * @return string  One of none, meeting, received, canceled
+     * @return integer A MEETING_* constant
      */
     public function getMeetingStatus()
     {
-        switch ($this->_getAttribute('meetingstatus')) {
-        case self::MEETING_NOT_MEETING:
-            return 'none';
-            break;
-        case self::MEETING_IS_MEETING:
-            return 'meeting';
-            break;
-        case  self::MEETING_RECEIVED:
-            return 'received';
-            break;
-        case self::MEETING_CANCELLED:
-            return 'canceled';
-            break;
-        default:
-            return;
-        }
+        return $this->_getAttribute('meetingstatus', self::MEETING_NOT_MEETING);
     }
 
     /**
index 9a641f3..4916937 100644 (file)
@@ -1216,13 +1216,16 @@ abstract class Kronolith_Event
         }
 
         /* Attendees */
-        foreach ($this->attendees as $email => $properties) {
-            $attendee = new Horde_ActiveSync_Message_Attendee();
-            $attendee->email = $email;
-            // AS only as required or opitonal
-            //$attendee->type = ($properties['attendance'] !== Kronolith::PART_REQUIRED ? Kronolith::PART_OPTIONAL : Kronolith::PART_REQUIRED);
-            //$attendee->status = $properties['response'];
-            $message->addAttendee($attendee);
+        if (count($this->attendees)) {
+            $message->setMeetingStatus(Horde_ActiveSync_Message_Appointment::MEETING_IS_MEETING);
+            foreach ($this->attendees as $email => $properties) {
+                $attendee = new Horde_ActiveSync_Message_Attendee();
+                $attendee->email = $email;
+                // AS only as required or opitonal
+                //$attendee->type = ($properties['attendance'] !== Kronolith::PART_REQUIRED ? Kronolith::PART_OPTIONAL : Kronolith::PART_REQUIRED);
+                //$attendee->status = $properties['response'];
+                $message->addAttendee($attendee);
+            }
         }
 
 //        /* Resources */