aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notifier.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-20 14:48:09 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-20 14:48:09 +0100
commit99073c56f03ff3978e6106c9760ec389ef6c3745 (patch)
treeff724817ce4685d76446f36780a991ef488504f9 /lib/mauve/notifier.rb
parent83860784c1d184dd6afa680aeff2e06d65f50b8d (diff)
Added configuration options to disable the notification/packet buffers.
Diffstat (limited to 'lib/mauve/notifier.rb')
-rw-r--r--lib/mauve/notifier.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/mauve/notifier.rb b/lib/mauve/notifier.rb
index 8a26b2c..c473acf 100644
--- a/lib/mauve/notifier.rb
+++ b/lib/mauve/notifier.rb
@@ -31,6 +31,18 @@ module Mauve
end
end
+
+ #
+ # This sends the notification for an alert
+ #
+ def notify(alert, at)
+ if alert.alert_group.nil?
+ logger.warn "Could not notify for #{alert} since there are no matching alert groups"
+ else
+ alert.alert_group.notify(alert, at)
+ end
+ end
+
private
@@ -86,12 +98,7 @@ module Mauve
# Empty the buffer, one notification at a time.
#
sz.times do
- alert, at = Server.notification_pop
- if alert.alert_group.nil?
- logger.warn "Could not notify for #{alert} since there are no matching alert groups"
- else
- alert.alert_group.notify(alert, at)
- end
+ notify(*Server.notification_pop)
end
end