mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-19 10:01:24 +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)
|
* will match raising, clearing, and also (if ReminderInterval is set)
|
||||||
* reminders about the alarm.
|
* reminders about the alarm.
|
||||||
* </desc>
|
* </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>
|
* <term>DurationAbove</term>
|
||||||
* <desc>For [EcAlarm] messages, this may be used to match any message
|
* <desc>For [EcAlarm] messages, this may be used to match any message
|
||||||
* whose duration in minutes is greater than the supplied integer value.
|
* whose duration in minutes is greater than the supplied integer value.
|
||||||
|
|
11
EcAlerter.m
11
EcAlerter.m
|
@ -116,6 +116,7 @@
|
||||||
NSString *serverName;
|
NSString *serverName;
|
||||||
NSString *severityText;
|
NSString *severityText;
|
||||||
NSString *text;
|
NSString *text;
|
||||||
|
NSString *component;
|
||||||
NSDate *timestamp;
|
NSDate *timestamp;
|
||||||
NSString *type;
|
NSString *type;
|
||||||
int duration;
|
int duration;
|
||||||
|
@ -148,6 +149,7 @@
|
||||||
RELEASE(severityText);
|
RELEASE(severityText);
|
||||||
RELEASE(text);
|
RELEASE(text);
|
||||||
RELEASE(timestamp);
|
RELEASE(timestamp);
|
||||||
|
RELEASE(component);
|
||||||
RELEASE(type);
|
RELEASE(type);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -833,6 +835,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
|
|
||||||
/* The next set are matches only for alarms.
|
/* 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 (nil != (s = [d objectForKey: @"ReminderInterval"]))
|
||||||
{
|
{
|
||||||
if (isReminder)
|
if (isReminder)
|
||||||
|
@ -1276,6 +1285,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
event->isAlarm = NO;
|
event->isAlarm = NO;
|
||||||
event->isClear = NO;
|
event->isClear = NO;
|
||||||
event->reminder = -1;
|
event->reminder = -1;
|
||||||
|
event->component = nil;
|
||||||
if (nil != identifier)
|
if (nil != identifier)
|
||||||
{
|
{
|
||||||
event->type = @"Alert";
|
event->type = @"Alert";
|
||||||
|
@ -1292,6 +1302,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
[EcAlarm stringFromSeverity: event->severity]);
|
[EcAlarm stringFromSeverity: event->severity]);
|
||||||
event->isAlarm = YES;
|
event->isAlarm = YES;
|
||||||
event->reminder = reminder;
|
event->reminder = reminder;
|
||||||
|
ASSIGN(event->component, [alarm moComponent]);
|
||||||
if ([@"Clear" isEqual: [alarm extra]])
|
if ([@"Clear" isEqual: [alarm extra]])
|
||||||
{
|
{
|
||||||
event->isClear = YES;
|
event->isClear = YES;
|
||||||
|
|
Loading…
Reference in a new issue