From edfe588a9a39a761c7433f4d019201505081e289 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 24 Aug 2011 17:26:21 +0100 Subject: Alert#all_unacknowledged created, reflecting reality of what all_raised was being used for XMPP alerts now sorted sanely --- lib/mauve/notifiers/xmpp.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/mauve/notifiers') 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" - < [: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" -- cgit v1.2.1