mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-15 13:24:54 +00:00
(fix) support EAS MIMETruncation
This commit is contained in:
@@ -695,13 +695,14 @@ struct GlobalObjectId {
|
||||
NSMutableString *s;
|
||||
id value;
|
||||
|
||||
int preferredBodyType, mimeSupport, nativeBodyType;
|
||||
int preferredBodyType, mimeSupport, mimeTruncation, nativeBodyType;
|
||||
uint32_t v;
|
||||
|
||||
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
|
||||
|
||||
preferredBodyType = [[context objectForKey: @"BodyPreferenceType"] intValue];
|
||||
mimeSupport = [[context objectForKey: @"MIMESupport"] intValue];
|
||||
mimeTruncation = [[context objectForKey: @"MIMETruncation"] intValue];
|
||||
|
||||
s = [NSMutableString string];
|
||||
|
||||
@@ -1007,9 +1008,64 @@ struct GlobalObjectId {
|
||||
AUTORELEASE(content);
|
||||
|
||||
content = [content activeSyncRepresentationInContext: context];
|
||||
truncated = 0;
|
||||
|
||||
len = [content length];
|
||||
truncated = 1;
|
||||
|
||||
// We handle MIMETruncation
|
||||
switch (mimeTruncation)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
content = @"";
|
||||
len = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
content = [content substringToIndex: 4096];
|
||||
len = 4096;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
content = [content substringToIndex: 5120];
|
||||
len = 5120;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
content = [content substringToIndex: 7168];
|
||||
len = 7168;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
content = [content substringToIndex: 10240];
|
||||
len = 10240;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
content = [content substringToIndex: 20480];
|
||||
len = 20480;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
content = [content substringToIndex: 51200];
|
||||
len = 51200;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
content = [content substringToIndex: 102400];
|
||||
len = 102400;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
truncated = 0;
|
||||
}
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
@@ -1017,7 +1073,7 @@ struct GlobalObjectId {
|
||||
[s appendFormat: @"<BodyTruncated xmlns=\"Email:\">%d</BodyTruncated>", truncated];
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
|
||||
// Set the correct type if client requested text/html but we got text/plain.
|
||||
@@ -1031,16 +1087,12 @@ struct GlobalObjectId {
|
||||
|
||||
[s appendFormat: @"<Truncated>%d</Truncated>", truncated];
|
||||
[s appendFormat: @"<Preview></Preview>"];
|
||||
|
||||
if (!truncated)
|
||||
{
|
||||
[s appendFormat: @"<Data>%@</Data>", content];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", len];
|
||||
}
|
||||
[s appendFormat: @"<Data>%@</Data>", content];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", len];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Attachments -namespace 16
|
||||
attachmentKeys = [self fetchFileAttachmentKeys];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user