From 1ac431fa21907a2a95d87901825cff3dc462746b Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 8 Jul 2011 17:24:08 +0100 Subject: Added first basic history functionality, and rejigged when notify is called for an alert. --- lib/mauve/notifiers/xmpp.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/mauve/notifiers/xmpp.rb') diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb index 4c30643..c4e1785 100644 --- a/lib/mauve/notifiers/xmpp.rb +++ b/lib/mauve/notifiers/xmpp.rb @@ -203,7 +203,17 @@ module Mauve alert.to_s end - send_message(destination_jid, txt) + history = Mauve::History.new(:alert_id => alert.id, :type => :notification) + + if send_message(destination_jid, txt) + history.event = "Sent XMPP message to #{destination_jid}" + history.save + true + else + history.event = "Failed to send XMPP message to #{destination_jid}" + history.save + false + end end # Sends a message to the destionation. -- cgit v1.2.1