Class: AptControl::Notify::Jabber
- Inherits:
-
Object
- Object
- AptControl::Notify::Jabber
- Includes:
- Jabber
- Defined in:
- lib/apt_control/notify.rb
Instance Method Summary collapse
- #connect! ⇒ Object
-
#initialize(options = {}) ⇒ Jabber
constructor
A new instance of Jabber.
- #message(msg) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Jabber
Returns a new instance of Jabber.
12 13 14 15 16 17 18 19 |
# File 'lib/apt_control/notify.rb', line 12 def initialize(={}) @jid = [:jid] @password = [:password] @room_jid = [:room_jid] @logger = [:logger] connect! end |
Instance Method Details
#connect! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/apt_control/notify.rb', line 21 def connect! # ::Jabber::debug = true @logger.info("Jabber connecting with jid #{@jid}") @client = Client.new(JID.new(@jid)) @client.connect @client.auth(@password) @muc = Jabber::MUC::SimpleMUCClient.new(@client) @muc.join(JID.new(@room_jid)) @logger.info("joined room #{@room_jid}") end |
#message(msg) ⇒ Object
33 34 35 |
# File 'lib/apt_control/notify.rb', line 33 def (msg) @muc.send(Message.new(nil, msg)) end |