From d2f69077b71f6a62045cd6fa0081fe99abdbbc27 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 19 Aug 2016 14:11:53 -0400 Subject: [PATCH] (fix) properly generate the BusyStatus for normal events --- ActiveSync/iCalEvent+ActiveSync.m | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m index 121f0b11b..1bb58bfd9 100644 --- a/ActiveSync/iCalEvent+ActiveSync.m +++ b/ActiveSync/iCalEvent+ActiveSync.m @@ -63,7 +63,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - (int) _attendeeStatus: (iCalPerson *) attendee { int attendee_status; - + attendee_status = 5; if ([[attendee partStat] caseInsensitiveCompare: @"ACCEPTED"] == NSOrderedSame) attendee_status = 3; @@ -75,6 +75,29 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. return attendee_status; } +// +// Possible values are: +// 0 Free +// 1 Tentative +// 2 Busy +// 3 Out of Office +// 4 Working elsewhere +// +- (int) _busyStatus: (iCalPerson *) attendee +{ + int attendee_status; + + attendee_status = 2; + + if ([[attendee partStat] caseInsensitiveCompare: @"DECLINED"] == NSOrderedSame) + attendee_status = 0; + else if ([[attendee partStat] caseInsensitiveCompare: @"TENTATIVE"] == NSOrderedSame) + attendee_status = 1; + + return attendee_status; +} + + - (NSString *) activeSyncRepresentationInContext: (WOContext *) context { NSMutableString *s; @@ -183,7 +206,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } else { - meetingStatus = 0; // appointment + meetingStatus = 0; // The event is an appointment, which has no attendees. } // This depends on the 'NEEDS-ACTION' parameter. @@ -204,6 +227,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [s appendFormat: @"%d", 1]; // BusyStatus -- http://msdn.microsoft.com/en-us/library/ee202290(v=exchg.80).aspx + [s appendFormat: @"%d", [self _busyStatus: attendee]]; + } + else + { + // If it's a normal event (ie, with no organizer/attendee) or we are the organizer to an event + // invitation, we set the busy status to 2 (Busy) [s appendFormat: @"%d", 2]; }