Skip to content

Commit

Permalink
(fix) remove over EAS alarms if we don't want them (fixes #4059)
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Apr 11, 2017
1 parent b4f5430 commit be52703
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion ActiveSync/SOGoActiveSyncDispatcher+Sync.m
Expand Up @@ -78,11 +78,14 @@
#import <SOGo/SOGoCacheGCSObject.h>
#import <SOGo/SOGoPermissions.h>

#import <NGCards/iCalCalendar.h>

#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentFolders.h>
#import <Appointments/SOGoTaskObject.h>
#import <Appointments/SOGoAppointmentFolder.h>

#import <Contacts/SOGoContactGCSEntry.h>
#import <Contacts/SOGoContactGCSFolder.h>
Expand Down Expand Up @@ -264,7 +267,26 @@ - (NSString *) _getNameInCache: (id) theCollection withType: (SOGoMicrosoftActiv
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];
}
}

//
// <?xml version="1.0"?>
Expand Down Expand Up @@ -1239,6 +1261,9 @@ - (void) processSyncGetChanges: (id <DOMElement>) theDocumentElement
d = [NSCalendarDate distantFuture];

[dateCache setObject: d forKey: uid];

if (!([theCollection showCalendarAlarms]))
[self _removeAllAlarmsFromCalendar: [componentObject parent]];
}

if (updated)
Expand Down Expand Up @@ -1599,7 +1624,7 @@ - (void) processSyncGetChanges: (id <DOMElement>) theDocumentElement
[s appendString: [mailObject activeSyncRepresentationInContext: context]];
[s appendString: @"</ApplicationData>"];
[s appendString: @"</Add>"];

[syncCache setObject: [aCacheObject sequence] forKey: [aCacheObject uid]];
[dateCache setObject: [NSCalendarDate date] forKey: [aCacheObject uid]];

Expand Down

0 comments on commit be52703

Please sign in to comment.