From 1b3dbb4be031ee5c35e586ee73e15a2f80f6f9ad Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 14 Feb 2011 23:43:05 +0000 Subject: [PATCH] Monotone-Parent: 5f859ec68ac3088a6a1a60e1cf887c3208974571 Monotone-Revision: 2434c6ad1961a254ac8fb9c01f787ace6e863ae3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-02-14T23:43:05 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 ++++++ OpenChange/MAPIStoreContext.m | 43 +++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4839c684e..80a143b95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-02-14 Wolfgang Sourdeau + * OpenChange/MAPIStoreContext.m + (-createMessagePropertiesWithMID:inFID:isAssociated:): create a + fake PR_SEARCH_KEY on new message to make Outlook happy when + composing invitations. + (-getProperties:ofTableType:inRow:withMID:): perform property + searches on "live messages" (unsaved ones) as well. + * OpenChange/MAPIStoreMailMessageTable.m (-restrictedChildKeys): no longer excluded messages marked with "\Deleted". (-getChildProperty:forKey:withTag:): display the right icon for diff --git a/OpenChange/MAPIStoreContext.m b/OpenChange/MAPIStoreContext.m index 44ec62bb5..5cffeacf0 100644 --- a/OpenChange/MAPIStoreContext.m +++ b/OpenChange/MAPIStoreContext.m @@ -46,6 +46,7 @@ #import "MAPIStoreMapping.h" #import "MAPIStoreTypes.h" #import "NSArray+MAPIStore.h" +#import "NSObject+MAPIStore.h" #import "NSString+MAPIStore.h" #import "MAPIStoreContext.h" @@ -901,7 +902,13 @@ _prepareContextClass (struct mapistore_context *newMemCtx, forKey: @"associated"]; [messageProperties setObject: [NSNumber numberWithInt: 1] forKey: @"mapiRetainCount"]; + + [messageProperties + setObject: [@"No subject" dataUsingEncoding: NSASCIIStringEncoding] + forKey: MAPIPropertyKey (PR_SEARCH_KEY)]; + [messages setObject: messageProperties forKey: midNbr]; + [messageProperties release]; } @@ -1056,8 +1063,10 @@ _prepareContextClass (struct mapistore_context *newMemCtx, NSArray *children; NSString *childURL, *folderURL, *childKey; NSInteger count; + NSDictionary *messageProperties; void *propValue; uint64_t fid; + id valueObject; const char *propName; enum MAPITAGS tag; enum MAPISTATUS propRc; @@ -1124,8 +1133,38 @@ _prepareContextClass (struct mapistore_context *newMemCtx, } else { - [self errorWithFormat: @"No url found for FMID: %lld", fmid]; - rc = MAPI_E_INVALID_OBJECT; + messageProperties = [messages objectForKey: + [NSNumber numberWithUnsignedLongLong: fmid]]; + if (messageProperties) + { + aRow->lpProps = talloc_array (aRow, struct SPropValue, + sPropTagArray->cValues); + aRow->cValues = sPropTagArray->cValues; + for (count = 0; count < sPropTagArray->cValues; count++) + { + tag = sPropTagArray->aulPropTag[count]; + + valueObject + = [messageProperties objectForKey: MAPIPropertyKey (tag)]; + if (valueObject) + propRc = [valueObject getMAPIValue: &propValue + forTag: tag + inMemCtx: memCtx]; + else + { + propValue = MAPILongValue (memCtx, MAPI_E_NOT_FOUND); + tag = (tag & 0xffff0000) | 0x000a; + } + + set_SPropValue_proptag (aRow->lpProps + count, tag, propValue); + } + rc = MAPI_E_SUCCESS; + } + else + { + [self errorWithFormat: @"No url found for FMID: %lld", fmid]; + rc = MAPI_E_INVALID_OBJECT; + } } return rc;