From 81f13404bfdac5e10cdff4522adaa7014ec587f4 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 22 Jan 2016 14:02:05 -0500 Subject: [PATCH] (fix) more fix regarding recurrence exceptions and body tags Conflicts: ActiveSync/iCalEvent+ActiveSync.m --- ActiveSync/iCalEvent+ActiveSync.m | 55 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m index a7e51cfde..cab57ff48 100644 --- a/ActiveSync/iCalEvent+ActiveSync.m +++ b/ActiveSync/iCalEvent+ActiveSync.m @@ -238,6 +238,34 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (![self recurrenceId] && [[self uid] length]) [s appendFormat: @"%@", [[self uid] activeSyncRepresentationInContext: context]]; + // Recurrence rules + if ([self isRecurrent]) + [s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]]; + + // Comment + o = [self comment]; + //if (![self recurrenceId] && [o length]) + if ([o length]) + { + // It is very important here to NOT set 0 in the response, + // otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details. + o = [o activeSyncRepresentationInContext: context]; + + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + { + [s appendFormat: @"%@", o]; + [s appendString: @"0"]; + } + else + { + [s appendString: @""]; + [s appendFormat: @"%d", 1]; + [s appendFormat: @"%d", (int)[o length]]; + [s appendFormat: @"%@", o]; + [s appendString: @""]; + } + } + // Sensitivity if ([[self accessClass] isEqualToString: @"PRIVATE"]) v = 2; @@ -270,7 +298,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [s appendString: [alarm activeSyncRepresentationInContext: context]]; } - // Recurrence rules + // Exceptions if ([self isRecurrent]) { NSMutableArray *components, *exdates; @@ -279,8 +307,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. unsigned int count, max, i; - [s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]]; - components = [NSMutableArray arrayWithArray: [[self parent] events]]; max = [components count]; @@ -343,29 +369,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - // Comment - o = [self comment]; - if ([o length]) - { - // It is very important here to NOT set 0 in the response, - // otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details. - o = [o activeSyncRepresentationInContext: context]; - - if ([self recurrenceId] || [[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) - { - [s appendFormat: @"%@", o]; - [s appendString: @"0"]; - } - else - { - [s appendString: @""]; - [s appendFormat: @"%d", 1]; - [s appendFormat: @"%d", (int)[o length]]; - [s appendFormat: @"%@", o]; - [s appendString: @""]; - } - } - if (![self recurrenceId]) [s appendFormat: @"%d", 1];