(fix) fixed EAS conversation ID issues on BB10 (#3152)

pull/91/head
Ludovic Marcotte 2015-07-22 10:26:09 -04:00
parent 731264d9dc
commit a8ab01a5eb
3 changed files with 51 additions and 4 deletions

View File

@ -2576,7 +2576,7 @@ static BOOL debugOn = NO;
NGMimeFileData *fdata;
NSException *error;
NSArray *attachmentKeys;
NSMutableArray *attachments;
NSMutableArray *attachments, *references;
id body, bodyFromSmartForward, htmlPart, textPart;
NSString *fullName, *email, *charset, *s;
@ -2615,7 +2615,25 @@ static BOOL debugOn = NO;
[map setObject: email forKey: @"from"];
if ([mailObject messageId])
[map setObject: [mailObject messageId] forKey: @"in-reply-to"];
{
[map setObject: [mailObject messageId] forKey: @"in-reply-to"];
references = [[[[[mailObject mailHeaders] objectForKey: @"references"] componentsSeparatedByString: @" "] mutableCopy] autorelease];
if ([references count] > 0)
{
// If there are more than ten identifiers listed, we eliminate the second one.
if ([references count] >= 10)
[references removeObjectAtIndex: 1];
[references addObject: [mailObject messageId]];
[map setObject: [references componentsJoinedByString:@" "] forKey: @"references"];
}
else
{
[map setObject: [mailObject messageId] forKey: @"references"];
}
}
messageToSend = [[[NGMimeMessage alloc] initWithHeader: map] autorelease];
body = [[[NGMimeMultipartBody alloc] initWithPart: messageToSend] autorelease];

View File

@ -550,6 +550,28 @@ struct GlobalObjectId {
return d;
}
- (NSString *) _getNormalizedSubject
{
NSString *subject;
NSUInteger colIdx;
NSString *stringValue;
subject = [[self subject] decodedHeader];
colIdx = [subject rangeOfString: @":" options:NSBackwardsSearch].location;
if (colIdx != NSNotFound && colIdx + 1 < [subject length])
stringValue = [[subject substringFromIndex: colIdx + 1] stringByTrimmingLeadSpaces];
else
stringValue = subject;
if (!stringValue)
stringValue = @"";
return stringValue;
}
//
//
//
@ -663,7 +685,7 @@ struct GlobalObjectId {
if (value)
{
[s appendFormat: @"<Subject xmlns=\"Email:\">%@</Subject>", [value activeSyncRepresentationInContext: context]];
[s appendFormat: @"<ThreadTopic xmlns=\"Email:\">%@</ThreadTopic>", [value activeSyncRepresentationInContext: context]];
[s appendFormat: @"<ThreadTopic xmlns=\"Email:\">%@</ThreadTopic>", [[self _getNormalizedSubject] activeSyncRepresentationInContext: context]];
}
// DateReceived
@ -1049,7 +1071,13 @@ struct GlobalObjectId {
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.0"] ||
[[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.1"])
{
if ([self inReplyTo])
NSString *reference;
reference = [[[[self mailHeaders] objectForKey: @"references"] componentsSeparatedByString: @" "] objectAtIndex: 0];
if ([reference length] > 0)
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[reference dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
else if ([self inReplyTo])
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self inReplyTo] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
else if ([self messageId])
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self messageId] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];

1
NEWS
View File

@ -20,6 +20,7 @@ Bug fixes
- Android EAS Lollipop fixes (#3268 and #3269)
- improved EAS email flagging handling (#3140)
- fixed computation of GlobalObjectId (#3235)
- fixed EAS conversation ID issues on BB10 (#3152)
2.3.0 (2015-06-01)
-------------------