From be527031bc4724e1718981de69f63c400b28ea08 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 11 Apr 2017 10:13:56 -0400 Subject: [PATCH] (fix) remove over EAS alarms if we don't want them (fixes #4059) --- ActiveSync/SOGoActiveSyncDispatcher+Sync.m | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index cb0c89d32..a6f653f4b 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -78,11 +78,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import #import +#import + #import #import #import #import #import +#import #import #import @@ -264,7 +267,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. return nameInCache; } +- (void) _removeAllAlarmsFromCalendar: (iCalCalendar *) theCalendar +{ + NSArray *allComponents; + iCalEntityObject *currentComponent; + NSUInteger count, max; + if (debugOn) + [self logWithFormat: @"EAS - Remove all alarms"]; + + allComponents = [theCalendar allObjects]; + + max = [allComponents count]; + for (count = 0; count < max; count++) + { + currentComponent = [allComponents objectAtIndex: count]; + if ([currentComponent isKindOfClass: [iCalEvent class]] || + [currentComponent isKindOfClass: [iCalToDo class]]) + [currentComponent removeAllAlarms]; + } +} // // @@ -1239,6 +1261,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. d = [NSCalendarDate distantFuture]; [dateCache setObject: d forKey: uid]; + + if (!([theCollection showCalendarAlarms])) + [self _removeAllAlarmsFromCalendar: [componentObject parent]]; } if (updated) @@ -1599,7 +1624,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [s appendString: [mailObject activeSyncRepresentationInContext: context]]; [s appendString: @""]; [s appendString: @""]; - + [syncCache setObject: [aCacheObject sequence] forKey: [aCacheObject uid]]; [dateCache setObject: [NSCalendarDate date] forKey: [aCacheObject uid]];