mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-16 00:21:01 +00:00
add support for alarm component matching
This commit is contained in:
parent
518f015c35
commit
92212e13e8
2 changed files with 17 additions and 0 deletions
|
@ -74,6 +74,12 @@
|
|||
* will match raising, clearing, and also (if ReminderInterval is set)
|
||||
* reminders about the alarm.
|
||||
* </desc>
|
||||
* <term>Component</term>
|
||||
* <desc>For [EcAlarm] messages, this may be used to match messages by
|
||||
* the alarm component. Specifying an empty value matches only alarms
|
||||
* with an empty component part.
|
||||
* If this is not specified, alarms with any component may match.
|
||||
* </desc>
|
||||
* <term>DurationAbove</term>
|
||||
* <desc>For [EcAlarm] messages, this may be used to match any message
|
||||
* whose duration in minutes is greater than the supplied integer value.
|
||||
|
|
11
EcAlerter.m
11
EcAlerter.m
|
@ -116,6 +116,7 @@
|
|||
NSString *serverName;
|
||||
NSString *severityText;
|
||||
NSString *text;
|
||||
NSString *component;
|
||||
NSDate *timestamp;
|
||||
NSString *type;
|
||||
int duration;
|
||||
|
@ -148,6 +149,7 @@
|
|||
RELEASE(severityText);
|
||||
RELEASE(text);
|
||||
RELEASE(timestamp);
|
||||
RELEASE(component);
|
||||
RELEASE(type);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -833,6 +835,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
|
||||
/* The next set are matches only for alarms.
|
||||
*/
|
||||
if (nil != (s = [d objectForKey: @"Component"]))
|
||||
{
|
||||
if (NO == [s isEqual: event->component])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (nil != (s = [d objectForKey: @"ReminderInterval"]))
|
||||
{
|
||||
if (isReminder)
|
||||
|
@ -1276,6 +1285,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
event->isAlarm = NO;
|
||||
event->isClear = NO;
|
||||
event->reminder = -1;
|
||||
event->component = nil;
|
||||
if (nil != identifier)
|
||||
{
|
||||
event->type = @"Alert";
|
||||
|
@ -1292,6 +1302,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
[EcAlarm stringFromSeverity: event->severity]);
|
||||
event->isAlarm = YES;
|
||||
event->reminder = reminder;
|
||||
ASSIGN(event->component, [alarm moComponent]);
|
||||
if ([@"Clear" isEqual: [alarm extra]])
|
||||
{
|
||||
event->isClear = YES;
|
||||
|
|
Loading…
Reference in a new issue