From df59b73a221467523c18c56493c13c86003d7271 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 26 Feb 2015 17:56:42 -0500 Subject: [PATCH] use correct mail attachment elements for EAS 2.5 clients - patch from tfu --- ActiveSync/SOGoMailObject+ActiveSync.m | 31 +++++++++++++++++++------- NEWS | 1 + 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index c2993ca7f..7386bc182 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -786,24 +786,39 @@ struct GlobalObjectId { if ([attachmentKeys count]) { int i; - - [s appendString: @""]; - + + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + [s appendString: @""]; + else + [s appendString: @""]; + for (i = 0; i < [attachmentKeys count]; i++) { value = [attachmentKeys objectAtIndex: i]; [s appendString: @""]; - [s appendFormat: @"%@", [[value objectForKey: @"filename"] activeSyncRepresentationInContext: context]]; + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + [s appendFormat: @"%@", [[value objectForKey: @"filename"] activeSyncRepresentationInContext: context]]; // FileReference must be a unique identifier across the whole store. We use the following structure: // mail// // mail/INBOX/2 - [s appendFormat: @"mail/%@/%@/%@", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]]; + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + [s appendFormat: @"mail/%@/%@/%@", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]]; + else + [s appendFormat: @"mail/%@/%@/%@", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]]; - [s appendFormat: @"%d", 1]; // See: http://msdn.microsoft.com/en-us/library/ee160322(v=exchg.80).aspx - [s appendFormat: @"%d", [[value objectForKey: @"size"] intValue]]; - //[s appendFormat: @"%d", 1]; + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + { + [s appendFormat: @"%d", 1]; + [s appendFormat: @"%d", [[value objectForKey: @"size"] intValue]]; + } + else + { + [s appendFormat: @"%d", 1]; // See: http://msdn.microsoft.com/en-us/library/ee160322(v=exchg.80).aspx + [s appendFormat: @"%d", [[value objectForKey: @"size"] intValue]]; + //[s appendFormat: @"%d", 1]; + } [s appendString: @""]; } diff --git a/NEWS b/NEWS index eac001565..fd7da7661 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ Bug fixes - use the correct body element for events for EAS 2.5 clients - SmartReply improvements for missing body attributes - do not use syncKey from cache when davCollectionTag = -1 + - use correct mail attachment elements for EAS 2.5 clients 2.2.16 (2015-02-12) -------------------