Monotone-Parent: 55595f6ee3aaa33db773a4eb60c184519b6f18fd

Monotone-Revision: 9488bb1220eb58936dc8d649bae5b7ecf2fe01fc

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-10-31T19:29:37
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-10-31 19:29:37 +00:00
parent 2a93ea4e6d
commit 4da013c4e3
3 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,9 @@
2011-10-31 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreMailMessage.m (-_fetchBodyData): fetch body
keys with BODY.PEEK rather than just BODY, to disabled the
automatic setting of the "\Seen" flag.
* SoObjects/Mailer/SOGoMailBodyPart.m (-fetchBLOBWithPeek:): new
method that enables the fetching of body parts either via "BODY"
or "BODY.PEEK".

View File

@ -187,7 +187,7 @@
- (int) getPrAttachDataBin: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
*data = [[sogoObject fetchBLOB] asBinaryInMemCtx: memCtx];
*data = [[sogoObject fetchBLOBWithPeek: YES] asBinaryInMemCtx: memCtx];
return MAPISTORE_SUCCESS;
}

View File

@ -76,7 +76,7 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
NSRange bodyRange;
NSString *strippedKey;
bodyRange = [self rangeOfString: @"body["];
bodyRange = [self rangeOfString: @"body.peek["];
if (bodyRange.length > 0)
{
strippedKey = [self substringFromIndex: NSMaxRange (bodyRange)];
@ -211,7 +211,8 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
keys = [NSMutableArray array];
[sogoObject addRequiredKeysOfStructure: [sogoObject bodyStructure]
path: @"" toArray: keys
acceptedTypes: acceptedTypes];
acceptedTypes: acceptedTypes
withPeek: YES];
[keys sortUsingFunction: _compareBodyKeysByPriority context: acceptedTypes];
if ([keys count] > 0)
{
@ -234,6 +235,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
- (void) _fetchBodyData
{
NSData *rawContent;
NSString *resultKey;
id result;
if (!headerSetup)
@ -243,7 +245,12 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
{
result = [sogoObject fetchParts: [NSArray arrayWithObject: mimeKey]];
result = [[result valueForKey: @"RawResponse"] objectForKey: @"fetch"];
rawContent = [[result objectForKey: mimeKey] objectForKey: @"data"];
if ([mimeKey hasPrefix: @"body.peek"])
resultKey = [NSString stringWithFormat: @"body[%@]",
[mimeKey _strippedBodyKey]];
else
resultKey = mimeKey;
rawContent = [[result objectForKey: resultKey] objectForKey: @"data"];
ASSIGN (bodyContent, [rawContent bodyDataFromEncoding: headerEncoding]);
}