(fix) remove over EAS alarms if we don't want them (fixes #4059)

pull/236/head
Ludovic Marcotte 2017-04-11 10:13:56 -04:00
parent 4cf59cd92e
commit c92d489017
1 changed files with 26 additions and 1 deletions

View File

@ -53,9 +53,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <SOGo/SOGoCacheGCSObject.h>
#import <SOGo/SOGoPermissions.h>
#import <NGCards/iCalCalendar.h>
#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/SOGoAppointmentObject.h>
#import <Appointments/SOGoTaskObject.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Contacts/SOGoContactGCSEntry.h>
@ -227,7 +230,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];
}
}
//
// <?xml version="1.0"?>
@ -1221,6 +1243,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)
@ -1581,7 +1606,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[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]];