diff options
Diffstat (limited to 'lib/mauve/notifiers')
-rw-r--r-- | lib/mauve/notifiers/email.rb | 1 | ||||
-rw-r--r-- | lib/mauve/notifiers/sms_aql.rb | 26 | ||||
-rw-r--r-- | lib/mauve/notifiers/xmpp.rb | 4 |
3 files changed, 6 insertions, 25 deletions
diff --git a/lib/mauve/notifiers/email.rb b/lib/mauve/notifiers/email.rb index b6a1e1b..a06d332 100644 --- a/lib/mauve/notifiers/email.rb +++ b/lib/mauve/notifiers/email.rb @@ -27,7 +27,6 @@ module Mauve @hostname = "localhost" @signature = "This is an automatic mailing, please do not reply." @subject_prefix = "" - @suppressed_changed = nil end def logger diff --git a/lib/mauve/notifiers/sms_aql.rb b/lib/mauve/notifiers/sms_aql.rb index 9181be3..54a3104 100644 --- a/lib/mauve/notifiers/sms_aql.rb +++ b/lib/mauve/notifiers/sms_aql.rb @@ -6,13 +6,11 @@ module Mauve module Sms require 'net/https' + class AQL GATEWAY = "https://gw1.aql.com/sms/sms_gw.php" - attr :username, true - attr :password, true - attr :from, true - attr :max_messages_per_alert, true + attr_writer :username, :password, :from attr_reader :name def initialize(name) @@ -64,31 +62,11 @@ module Mauve logger.error("Could not find sms.txt.erb template") alert.to_s end - - others = all_alerts-[alert] - if !others.empty? - txt += (1 == others.length)? - "and a lone other." : - "and #{others.length} others." - #txt += "and #{others.length} others: " - #txt += others.map { |alert| alert.summary_one_line }.join(", ") - end - - # TODO: Fix link to be accurate. - # txt += "link: https://alert.bytemark.co.uk/alerts" - - ## @TODO: Add a link to acknowledge the alert in the text? - #txt += "Acknoweledge alert: "+ - # "https://alert.bytemark.co.uk/alert/acknowledge/"+ - # "#{alert.id}/#{alert.get_default_acknowledge_time} - - txt end def normalize_number(n) n.split("").select { |s| (?0..?9).include?(s[0]) }.join.gsub(/^0/, "44") end - include Debug end end end diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb index 991194d..7cb71c4 100644 --- a/lib/mauve/notifiers/xmpp.rb +++ b/lib/mauve/notifiers/xmpp.rb @@ -169,6 +169,10 @@ module Mauve @client.close! end end + + def ready? + @client.is_a?(Jabber::Client) and @client.is_connected? + end # # Takes an alert and converts it into a message. |