From 7c27e39fe73cc2bd3e745d8c349776d9ca2be705 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Nov 2010 21:07:59 +0000 Subject: [PATCH] Monotone-Parent: fc3e20fe8fbb851b3907c12e8221e62533f2cea1 Monotone-Revision: c128393b8fefa2da4bb9673a620d1e0baa64a839 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-11-30T21:07:59 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ OpenChange/MAPIStoreMailContext.m | 28 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0da75695..213222452 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-11-30 Wolfgang Sourdeau + * OpenChange/MAPIStoreMailContext.m + (-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:): + when the property is larger than 4000 bytes, register it in a + "message" dictionary and return MAPI_E_NOT_ENOUGH_MEMORY so that + it can be fetched later via the streaming mechanism. + * OpenChange/MAPIStoreTypes.h (MAPIPropertyNumber): changed the prototype to use an enum MAPITAGS instead of an int32_t. diff --git a/OpenChange/MAPIStoreMailContext.m b/OpenChange/MAPIStoreMailContext.m index 508c13073..eb5d32017 100644 --- a/OpenChange/MAPIStoreMailContext.m +++ b/OpenChange/MAPIStoreMailContext.m @@ -208,12 +208,23 @@ result = [[result valueForKey: @"RawResponse"] objectForKey: @"fetch"]; key = [[keys objectAtIndex: 0] objectForKey: @"key"]; content = [[result objectForKey: key] objectForKey: @"data"]; - stringContent = [[NSString alloc] initWithData: content - encoding: NSISOLatin1StringEncoding]; + if ([content length] > 3999) + { + [self registerValue: content + asProperty: proptag + forURL: childURL]; + *data = NULL; + rc = MAPI_E_NOT_ENOUGH_MEMORY; + } + else + { + stringContent = [[NSString alloc] initWithData: content + encoding: NSISOLatin1StringEncoding]; - // *data = NULL; - // rc = MAPI_E_NOT_FOUND; - *data = [stringContent asUnicodeInMemCtx: memCtx]; + // *data = NULL; + // rc = MAPI_E_NOT_FOUND; + *data = [stringContent asUnicodeInMemCtx: memCtx]; + } } else { @@ -248,8 +259,11 @@ content = [[result objectForKey: key] objectForKey: @"data"]; if ([content length] > 3999) { + [self registerValue: content + asProperty: proptag + forURL: childURL]; *data = NULL; - rc = MAPI_E_NOT_ENOUGH_RESOURCES; + rc = MAPI_E_NOT_ENOUGH_MEMORY; } else *data = [content asBinaryInMemCtx: memCtx]; @@ -267,7 +281,7 @@ /* We don't handle any RTF content. */ case PR_RTF_COMPRESSED: - rc = MAPI_E_NOT_FOUND; + rc = MAPI_E_NOT_ENOUGH_MEMORY; break; case PR_RTF_IN_SYNC: *data = MAPIBoolValue (memCtx, NO);