Class: Eye::Notify::Jabber

Inherits:
Eye::Notify show all
Defined in:
lib/eye/notify/jabber.rb

Constant Summary

Constants inherited from Eye::Notify

TIMEOUT, TYPES

Instance Method Summary collapse

Methods inherited from Eye::Notify

#async_notify, get_class, #initialize, #logger_sub_tag, #message_body, #message_subject, notify, #notify, register, requires, validate!

Methods included from Dsl::Validation

included

Constructor Details

This class inherits a constructor from Eye::Notify

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/eye/notify/jabber.rb', line 15

def execute
  debug { "send jabber #{[host, port, user, password]} - #{[contact, message_body]}" }

  mes = ::Jabber::Message.new(contact, message_body)
  mes.set_type(:normal)
  mes.set_id('1')
  mes.set_subject(message_subject)

  client = ::Jabber::Client.new(::Jabber::JID.new("#{user}/Eye"))
  client.connect(host, port)
  client.auth(password)
  client.send(mes)
  client.close
end