mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-15 19:55:56 +00:00
Monotone-Parent: a0e83a1784478d41763fc4ebb3eb9ee8a5142b5a
Monotone-Revision: 55595f6ee3aaa33db773a4eb60c184519b6f18fd Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-31T19:28:22 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
2011-10-31 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Mailer/SOGoMailBodyPart.m (-fetchBLOBWithPeek:): new
|
||||
method that enables the fetching of body parts either via "BODY"
|
||||
or "BODY.PEEK".
|
||||
|
||||
* SoObjects/Mailer/SOGoMailObject.m
|
||||
(-addRequiredKeysOfStructure:path:toArray:acceptedTypes:withPeek:):
|
||||
added a "withPeek" parameter that enables the fetching of body
|
||||
parts either via "BODY" or "BODY.PEEK".
|
||||
|
||||
2011-10-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailVolatileMessage.m (_generateMailData):
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
- (id) partInfo;
|
||||
- (NSData *) fetchBLOB;
|
||||
- (NSData *) fetchBLOBWithPeek: (BOOL) withPeek;
|
||||
- (void) setAsAttachment;
|
||||
|
||||
/* factory */
|
||||
|
||||
@@ -258,7 +258,7 @@ static BOOL debugOn = NO;
|
||||
|
||||
/* fetch */
|
||||
|
||||
- (NSData *) fetchBLOB
|
||||
- (NSData *) fetchBLOBWithPeek: (BOOL) withPeek
|
||||
{
|
||||
// HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, MIME, TEXT
|
||||
NSString *enc;
|
||||
@@ -266,7 +266,8 @@ static BOOL debugOn = NO;
|
||||
|
||||
data = [[self imap4Connection] fetchContentOfBodyPart:
|
||||
[self bodyPartIdentifier]
|
||||
atURL:[self imap4URL]];
|
||||
atURL:[self imap4URL]
|
||||
withPeek: withPeek];
|
||||
if (data == nil) return nil;
|
||||
|
||||
/* check for content encodings */
|
||||
@@ -299,6 +300,11 @@ static BOOL debugOn = NO;
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSData *) fetchBLOB
|
||||
{
|
||||
return [self fetchBLOBWithPeek: NO];
|
||||
}
|
||||
|
||||
/* WebDAV */
|
||||
|
||||
- (NSString *)contentTypeForBodyPartInfo:(id)_info {
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
= [NSArray arrayWithObjects: @"text/plain", @"text/html", nil];
|
||||
keys = [NSMutableArray array];
|
||||
[self addRequiredKeysOfStructure: [self bodyStructure]
|
||||
path: @"" toArray: keys acceptedTypes: acceptedTypes];
|
||||
path: @"" toArray: keys acceptedTypes: acceptedTypes
|
||||
withPeek: NO];
|
||||
|
||||
return [self _contentForEditingFromKeys: keys];
|
||||
}
|
||||
|
||||
@@ -126,7 +126,8 @@ NSArray *SOGoMailCoreInfoKeys;
|
||||
- (void) addRequiredKeysOfStructure: (NSDictionary *) info
|
||||
path: (NSString *) p
|
||||
toArray: (NSMutableArray *) keys
|
||||
acceptedTypes: (NSArray *) types;
|
||||
acceptedTypes: (NSArray *) types
|
||||
withPeek: (BOOL) withPeek;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -527,6 +527,7 @@ static BOOL debugSoParts = NO;
|
||||
path: (NSString *) p
|
||||
toArray: (NSMutableArray *) keys
|
||||
acceptedTypes: (NSArray *) types
|
||||
withPeek: (BOOL) withPeek
|
||||
{
|
||||
/*
|
||||
This is used to collect the set of IMAP4 fetch-keys required to fetch
|
||||
@@ -539,9 +540,11 @@ static BOOL debugSoParts = NO;
|
||||
unsigned i, count;
|
||||
NSString *k;
|
||||
id body;
|
||||
NSString *sp, *mimeType;
|
||||
NSString *bodyToken, *sp, *mimeType;
|
||||
id childInfo;
|
||||
|
||||
bodyToken = (withPeek ? @"body.peek" : @"body");
|
||||
|
||||
mimeType = [[NSString stringWithFormat: @"%@/%@",
|
||||
[info valueForKey: @"type"],
|
||||
[info valueForKey: @"subtype"]]
|
||||
@@ -549,7 +552,7 @@ static BOOL debugSoParts = NO;
|
||||
if ([types containsObject: mimeType])
|
||||
{
|
||||
if ([p length] > 0)
|
||||
k = [NSString stringWithFormat: @"body[%@]", p];
|
||||
k = [NSString stringWithFormat: @"%@[%@]", bodyToken, p];
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -557,7 +560,7 @@ static BOOL debugSoParts = NO;
|
||||
entities?
|
||||
TODO: check with HTML
|
||||
*/
|
||||
k = @"body[text]";
|
||||
k = [NSString stringWithFormat: @"%@[text]", bodyToken];
|
||||
}
|
||||
[keys addObject: [NSDictionary dictionaryWithObjectsAndKeys: k, @"key",
|
||||
mimeType, @"mimeType", nil]];
|
||||
@@ -575,7 +578,8 @@ static BOOL debugSoParts = NO;
|
||||
|
||||
[self addRequiredKeysOfStructure: childInfo
|
||||
path: sp toArray: keys
|
||||
acceptedTypes: types];
|
||||
acceptedTypes: types
|
||||
withPeek: withPeek];
|
||||
}
|
||||
|
||||
/* check body */
|
||||
@@ -600,7 +604,8 @@ static BOOL debugSoParts = NO;
|
||||
sp = [p length] > 0 ? (id)[p stringByAppendingString: @".1"] : (id)@"1";
|
||||
[self addRequiredKeysOfStructure: body
|
||||
path: sp toArray: keys
|
||||
acceptedTypes: types];
|
||||
acceptedTypes: types
|
||||
withPeek: withPeek];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,7 +623,8 @@ static BOOL debugSoParts = NO;
|
||||
@"application/pgp-signature", nil];
|
||||
ma = [NSMutableArray arrayWithCapacity: 4];
|
||||
[self addRequiredKeysOfStructure: [self bodyStructure]
|
||||
path: @"" toArray: ma acceptedTypes: types];
|
||||
path: @"" toArray: ma acceptedTypes: types
|
||||
withPeek: NO];
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user