diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mauve/notifiers/email.rb | 15 | ||||
-rw-r--r-- | lib/mauve/notifiers/xmpp.rb | 15 | ||||
-rw-r--r-- | lib/mauve/person.rb | 1 |
3 files changed, 20 insertions, 11 deletions
diff --git a/lib/mauve/notifiers/email.rb b/lib/mauve/notifiers/email.rb index c445e09..2c14a54 100644 --- a/lib/mauve/notifiers/email.rb +++ b/lib/mauve/notifiers/email.rb @@ -80,8 +80,7 @@ module Mauve m.header.from = @from m.header.date = MauveTime.now - summary_formatted = "" -# summary_formatted = " * "+alert.summary_two_lines.join("\n ") + summary_formatted = " * "+alert.summary_two_lines.join("\n ") case alert.update_type.to_sym when :cleared @@ -99,8 +98,8 @@ module Mauve # FIXME: include alert.detail as multipart mime ##Thread.abort_on_exception = true m.body += "\n" + '-'*10 + " This is the detail field " + '-'*44 + "\n\n" - #m.body += alert.get_details() - #m.body += alert.get_details_plain_text() + m.body += alert.get_details() + m.body += alert.get_details_plain_text() m.body += "\n" + '-'*80 + "\n\n" if @suppressed_changed == true @@ -122,12 +121,12 @@ single alert, you must watch the web front-end instead. "There is currently one other alert outstanding:\n\n" : "There are currently #{other_alerts.length} other alerts outstanding:\n\n" -# other_alerts.each do |other| -# m.body += " * "+other.summary_two_lines.join("\n ")+"\n\n" -# end + other_alerts.each do |other| + m.body += " * "+other.summary_two_lines.join("\n ")+"\n\n" + end end - m.body += @email_suffix + m.body += "-- \n"+@signature m.to_s end diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb index d216788..18df6b2 100644 --- a/lib/mauve/notifiers/xmpp.rb +++ b/lib/mauve/notifiers/xmpp.rb @@ -64,8 +64,6 @@ module Mauve logger.debug "Jabber starting connection to #{@jid}" @client = Client.new(JID::new(@jid)) @client.connect - logger.debug "Jabber authentication" - @client.auth_nonsasl(@password, false) @roster = Roster::Helper.new(@client) @@ -79,11 +77,16 @@ module Mauve ensure_roster_and_subscription!(stanza.from) end.join end + + @client.add_message_callback do |m| + receive_message(m) + end @roster.wait_for_roster logger.debug "Jabber authenticated, setting presence" @client.send(Presence.new.set_type(:available)) + @mucs = {} logger.debug "Jabber is ready in theory" @@ -290,6 +293,14 @@ module Mauve end end + + # + # TODO parse message and ack as needed..? The trick is here to + # understand what the person sending the message wants. Could be + # difficult. + def receive_message(message) + @logger.debug "Received message from #{message.from}.. Ignoring for now." + end end end end diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb index 6e9fcb4..da3aa13 100644 --- a/lib/mauve/person.rb +++ b/lib/mauve/person.rb @@ -128,7 +128,6 @@ module Mauve # being raised. send_alert(level, alert) if last_change.was_relevant_when_raised? end - end end def remind(alert, level) |