Sha256: 87a5897863e1dd1774967b1d3db8299b195a3e3465bc06e9ee5700ae26e5e220

Contents?: true

Size: 772 Bytes

Versions: 5

Compression:

Stored size: 772 Bytes

Contents

require 'xmpp4r'

class Eye::Notify::Jabber < Eye::Notify

  # Eye.config do
  #   jabber :host => "some.host", :port => 12345, :user => "eye@some.host", :password => "123456"
  #   contact :vasya, :jabber, "vasya@some.host"
  # end

  param :host, String, true
  param :port, [String, Fixnum], true
  param :user, String, true
  param :password, String

  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

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eye-0.9.pre lib/eye/notify/jabber.rb
eye-0.8.1 lib/eye/notify/jabber.rb
eye-0.8.celluloid15 lib/eye/notify/jabber.rb
eye-0.8 lib/eye/notify/jabber.rb
eye-0.8.rc lib/eye/notify/jabber.rb