From 731a6bd1d5e3d7d46ca2ecef18ebe7ce186fc7b8 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 19 Sep 2011 23:33:48 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: aca091adf5e547dd91cb88d06d42c6cfd3fbe7e2 Monotone-Revision: 90fa2838afb37a071037bbb22e7b90cd8d61b44b Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-09-19T23:33:48 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++ OpenChange/MAPIStoreAppointmentWrapper.m | 11 +++++- OpenChange/MAPIStoreCalendarMessage.m | 49 ++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7646db48a..9fab674a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * OpenChange/MAPIStoreDraftsMessage.m: (_commitProperties) We now correctly handle the "importance" property + * Added handling of PR_IMPORTANCE and PidLidBusyStatus + for event objects + 2011-09-14 Ludovic Marcotte * SoObjects/Mailer/SOGoMailBaseObject.m: (imap4Connection): diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 6238dd3c3..99cb7012a 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -332,10 +332,17 @@ static NSCharacterSet *hexCharacterSet = nil; return MAPISTORE_SUCCESS; } -- (int) getPidLidBusyStatus: (void **) data // TODO +- (int) getPidLidBusyStatus: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { - *data = MAPILongValue (memCtx, 0x02); + uint8_t value; + + value = 0x2; // olBusy + + if (![event isOpaque]) + value = 0x0; // olFree + + *data = MAPILongValue (memCtx, value); return MAPISTORE_SUCCESS; } diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 73db29cde..c88b59260 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -330,7 +330,7 @@ iCalDateTime *start, *end; iCalTimeZone *tz; NSCalendarDate *now; - NSString *content, *tzName; + NSString *content, *tzName, *priority; iCalEvent *newEvent; iCalPerson *userPerson; NSUInteger responseStatus = 0; @@ -432,10 +432,10 @@ [start setDateTime: value]; } - // end - value = [newProperties objectForKey: MAPIPropertyKey (PR_END_DATE)]; + /* end */ + value = [newProperties objectForKey: MAPIPropertyKey(PR_END_DATE)]; if (!value) - value = [newProperties objectForKey: MAPIPropertyKey (PidLidAppointmentEndWhole)]; + value = [newProperties objectForKey: MAPIPropertyKey(PidLidAppointmentEndWhole)]; if (value) { end = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtend"]; @@ -443,6 +443,47 @@ [end setDateTime: value]; } + /* priority */ + value = [newProperties objectForKey: MAPIPropertyKey(PR_IMPORTANCE)]; + if (value) + { + switch ([value intValue]) + { + case 0: // IMPORTANCE_LOW + priority = @"9"; + break; + case 2: // IMPORTANCE_HIGH + priority = @"1"; + break; + default: // IMPORTANCE_NORMAL + priority = @"5"; + } + } + else + priority = @"0"; // None + [newEvent setPriority: priority]; + + /* show time as free/busy/tentative/out of office. Possible values are: + 0x00000000 - olFree + 0x00000001 - olTentative + 0x00000002 - olBusy + 0x00000003 - olOutOfOffice */ + value = [newProperties objectForKey: MAPIPropertyKey(PidLidBusyStatus)]; + if (value) + { + switch ([value intValue]) + { + case 0: + [newEvent setTransparency: @"TRANSPARENT"]; + break; + case 1: + case 2: + case 3: + default: + [newEvent setTransparency: @"OPAQUE"]; + } + } + /* recurrence */ value = [newProperties objectForKey: MAPIPropertyKey (PidLidAppointmentRecur)];