aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notifiers
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-24 17:26:21 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-24 17:26:21 +0100
commitedfe588a9a39a761c7433f4d019201505081e289 (patch)
tree1df23a4bd82ec17be81e61e1e64e8f3d640839a5 /lib/mauve/notifiers
parentc22a82f711abc51eebced905588c9527a9db8895 (diff)
Alert#all_unacknowledged created, reflecting reality of what all_raised was being used for
XMPP alerts now sorted sanely
Diffstat (limited to 'lib/mauve/notifiers')
-rw-r--r--lib/mauve/notifiers/xmpp.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb
index 38d7242..6a94ba8 100644
--- a/lib/mauve/notifiers/xmpp.rb
+++ b/lib/mauve/notifiers/xmpp.rb
@@ -442,14 +442,15 @@ module Mauve
def parse_command(msg)
case msg.body
- when /help/i
- do_parse_help(msg)
when /show\s?/i
do_parse_show(msg)
when /ack/i
do_parse_ack(msg)
+ when /(\w+\W+){5,}\w/
+ do_parse_help(msg)
+ File.executable?('/usr/games/fortune') ? `/usr/games/fortune -s -n 60`.chomp : "I'd love to stay and chat, but I'm really quite busy"
else
- File.executable?('/usr/games/fortune') ? `/usr/games/fortune -s -n 60`.chomp : "Sorry. I don't understand. Try asking me for help."
+ do_parse_help(msg)
end
end
@@ -458,8 +459,8 @@ module Mauve
cmd = $1
return case cmd
- when "show"
- <<EOF
+ when /^show/
+ <<EOF
Show command: Lists all raised or acknowledged alerts, or the first or last few.
e.g.
show -- shows all raised alerts
@@ -493,11 +494,11 @@ EOF
items = case type
when "acknowledged"
- Alert.all_acknowledged
+ Alert.all_acknowledged.all(:order => [:acknowledged_at.asc])
when "events"
History.all(:created_at.gte => Time.now - 24.hours)
else
- Alert.all_raised
+ Alert.all_unacknowledged.all(:order => [:raised_at.asc])
end
if first_or_last == "first"