From 1e9a61705cef5378d3aec994c12390fa8d20aa6c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 9 Nov 2011 20:10:31 +0000 Subject: [PATCH] Monotone-Parent: ead3fff3d76689011b8b8b7eac980671612662e5 Monotone-Revision: 2448001ef69730541ee1c822cf80c131176b1ed0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-09T20:10:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ OpenChange/MAPIStoreContactsMessage.m | 28 +++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 188a6da8b..9bfcc8645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-11-09 Wolfgang Sourdeau + * OpenChange/MAPIStoreContactsMessage.m (-save): set the NOTE + field to the value of PR_BODY_UNICODE or, a textual version of + PR_HTML. + * OpenChange/MAPIStoreMessage.m (-addProperties): intercept PR_RTF_COMPRESSED attributes and convert them automatically to a PR_HTML attribute. diff --git a/OpenChange/MAPIStoreContactsMessage.m b/OpenChange/MAPIStoreContactsMessage.m index 764e1ea90..8b5bd75b8 100644 --- a/OpenChange/MAPIStoreContactsMessage.m +++ b/OpenChange/MAPIStoreContactsMessage.m @@ -27,10 +27,12 @@ #import #import #import -#import #import #import +#import +#import #import +#import #import "MAPIStoreContactsAttachment.h" #import "MAPIStoreContactsFolder.h" @@ -337,10 +339,16 @@ { int rc = MAPISTORE_SUCCESS; NSString *stringValue; + NSArray *values; stringValue = [[sogoObject vCard] note]; if ([stringValue length] > 0) - *data = [stringValue asUnicodeInMemCtx: memCtx]; + { + /* 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; @@ -1117,6 +1125,22 @@ fromProperties: [attachment properties]]; } + /* Note */ + 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) + [newCard setNote: value]; + // // we save the new/modified card //