oc-appointments: ignore alarms already triggered

This commit is contained in:
Jesús García Sáez
2015-01-28 12:56:27 +01:00
parent d5ec25ee62
commit 5258ee2e76
+13 -4
View File
@@ -1835,16 +1835,25 @@ ReservedBlockEE2Size: 00 00 00 00
NSArray *alarms; NSArray *alarms;
NSUInteger count, max; NSUInteger count, max;
iCalAlarm *currentAlarm; iCalAlarm *currentAlarm;
NSString *action; NSString *action, *webstatus;
alarms = [event alarms]; alarms = [event alarms];
max = [alarms count]; max = [alarms count];
for (count = 0; !alarm && count < max; count++) for (count = 0; !alarm && count < max; count++)
{ {
currentAlarm = [alarms objectAtIndex: count]; currentAlarm = [alarms objectAtIndex: count];
action = [[currentAlarm action] lowercaseString];
if (!action || [action isEqualToString: @"display"]) // Only handle 'display' alarms
ASSIGN (alarm, currentAlarm); action = [currentAlarm action];
if ([action caseInsensitiveCompare: @"display"] != NSOrderedSame)
continue;
// Ignore alarms already triggered
webstatus = [[currentAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
if ([webstatus caseInsensitiveCompare: @"triggered"] == NSOrderedSame)
continue;
ASSIGN (alarm, currentAlarm);
} }
alarmSet = YES; alarmSet = YES;