From 9b847a276c5bf442a67975078d13c028a112a579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Sun, 15 Feb 2015 23:52:06 +0100 Subject: [PATCH] oc-calendar: Implement categories to share the colour See [MS-OXCICAL] Section 2.1.3.1.1.20.3 for details. It requires https://github.com/openchange/openchange/pull/216 to retrieve the value from MAPI client --- OpenChange/MAPIStoreAppointmentWrapper.m | 17 +++++++++++++++++ OpenChange/iCalEvent+MAPIStore.m | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 3f3708915..7fa60c5c5 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -45,6 +45,7 @@ #import "MAPIStoreRecurrenceUtils.h" #import "MAPIStoreSamDBUtils.h" #import "MAPIStoreTypes.h" +#import "NSArray+MAPIStore.h" #import "NSData+MAPIStore.h" #import "NSDate+MAPIStore.h" #import "NSObject+MAPIStore.h" @@ -1243,6 +1244,22 @@ static NSCharacterSet *hexCharacterSet = nil; return MAPISTORE_SUCCESS; } +- (int) getPidNameKeywords: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx +{ + /* See [MS-OXCICAL] Section 2.1.3.1.1.20.3 */ + NSArray *categories; + + categories = [event categories]; + if (categories) + { + *data = [categories asMVUnicodeInMemCtx: memCtx]; + return MAPISTORE_SUCCESS; + } + else + return MAPISTORE_ERR_NOT_FOUND; +} + - (int) getPidTagBody: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { diff --git a/OpenChange/iCalEvent+MAPIStore.m b/OpenChange/iCalEvent+MAPIStore.m index 1c94b8ee3..8d7269620 100644 --- a/OpenChange/iCalEvent+MAPIStore.m +++ b/OpenChange/iCalEvent+MAPIStore.m @@ -305,6 +305,12 @@ if (class) [self setAccessClass: class]; + /* Categories */ + /* See [MS-OXCICAL] Section 2.1.3.1.1.20.3 */ + value = [properties objectForKey: MAPIPropertyKey (PidNameKeywords)]; + if (value) + [self setCategories: value]; + /* show time as free/busy/tentative/out of office. Possible values are: 0x00000000 - olFree 0x00000001 - olTentative