(fix) fixed EAS conversation ID issues on BB10 (#3152)
parent
731264d9dc
commit
a8ab01a5eb
|
@ -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,8 +2615,26 @@ static BOOL debugOn = NO;
|
|||
[map setObject: email forKey: @"from"];
|
||||
|
||||
if ([mailObject messageId])
|
||||
{
|
||||
[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];
|
||||
|
||||
|
|
|
@ -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]];
|
||||
|
|
Loading…
Reference in New Issue