diff --git a/ChangeLog b/ChangeLog index 9bfcc8645..756534b7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-11-09 Wolfgang Sourdeau + * OpenChange/MAPIStoreCalendarMessage.m (-save): set the DESCRIPTION + field to the value of PR_BODY_UNICODE or, a textual version of + PR_HTML. COMMENT would be nice later. + + * OpenChange/MAPIStoreAppointmentWrapper.m (-getPrBody:inMemCtx:): + make use of -[NSString asCardAttributeValues]. + * OpenChange/MAPIStoreContactsMessage.m (-save): set the NOTE field to the value of PR_BODY_UNICODE or, a textual version of PR_HTML. diff --git a/OpenChange/MAPIStoreAppointmentWrapper.h b/OpenChange/MAPIStoreAppointmentWrapper.h index 7f14c5401..4fcf2b4d8 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.h +++ b/OpenChange/MAPIStoreAppointmentWrapper.h @@ -92,8 +92,6 @@ extern NSTimeZone *utcTZ; inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPrMessageClass: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; -- (int) getPrBody: (void **) data - inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPrStartDate: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidLidAppointmentStateFlags: (void **) data @@ -129,6 +127,8 @@ extern NSTimeZone *utcTZ; inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPrImportance: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; +- (int) getPrBody: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidLidIsRecurring: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidLidRecurring: (void **) data diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 1f87abad0..216ba3795 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -629,20 +629,6 @@ static NSCharacterSet *hexCharacterSet = nil; return [self getYes: data inMemCtx: memCtx]; } -- (int) getPrBody: (void **) data - inMemCtx: (TALLOC_CTX *) memCtx -{ - NSString *stringValue; - - stringValue = [event comment]; - if (!stringValue) - stringValue = @""; - - *data = [stringValue asUnicodeInMemCtx: memCtx]; - - return MAPISTORE_SUCCESS; -} - - (int) getPrStartDate: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { @@ -1035,6 +1021,28 @@ static NSCharacterSet *hexCharacterSet = nil; return MAPISTORE_SUCCESS; } +- (int) getPrBody: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx +{ + int rc = MAPISTORE_SUCCESS; + NSString *stringValue; + NSArray *values; + + /* FIXME: there is a confusion in NGCards around "comment" and "description" */ + stringValue = [event comment]; + if ([stringValue length] > 0) + { + /* FIXME: this is a temporary hack: we unescape things although NGVCards + should already have done it at this stage... */ + values = [stringValue asCardAttributeValues]; + *data = [[values objectAtIndex: 0] asUnicodeInMemCtx: memCtx]; + } + else + rc = MAPISTORE_ERR_NOT_FOUND; + + return rc; +} + - (int) getPidLidIsRecurring: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 1113b02b1..5de94e2d6 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -46,6 +46,7 @@ #import #import #import +#import #import "MAPIStoreAppointmentWrapper.h" #import "MAPIStoreCalendarAttachment.h" @@ -241,6 +242,12 @@ return [[self appointmentWrapper] getPrImportance: data inMemCtx: memCtx]; } +- (int) getPrBody: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx +{ + return [[self appointmentWrapper] getPrBody: data inMemCtx: memCtx]; +} + - (int) getPidLidIsRecurring: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { @@ -797,6 +804,22 @@ [newEvent setTransparency: @"OPAQUE"]; } } + + /* Comment */ + value = [properties objectForKey: MAPIPropertyKey (PR_BODY_UNICODE)]; + if (!value) + { + value = [properties objectForKey: MAPIPropertyKey (PR_HTML)]; + if (value) + { + value = [[NSString alloc] initWithData: value + encoding: NSUTF8StringEncoding]; + [value autorelease]; + value = [value htmlToText]; + } + } + if (value) + [newEvent setComment: value]; /* recurrence */ value = [properties