diff --git a/EcAlerter.h b/EcAlerter.h
index 12686c5..ec1ae3d 100644
--- a/EcAlerter.h
+++ b/EcAlerter.h
@@ -74,6 +74,12 @@
* will match raising, clearing, and also (if ReminderInterval is set)
* reminders about the alarm.
*
+ * Component
+ * 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.
+ *
* DurationAbove
* For [EcAlarm] messages, this may be used to match any message
* whose duration in minutes is greater than the supplied integer value.
diff --git a/EcAlerter.m b/EcAlerter.m
index 0f8a66e..49e619e 100644
--- a/EcAlerter.m
+++ b/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;