Class: JabberTee::Client
- Inherits:
-
Object
- Object
- JabberTee::Client
- Defined in:
- lib/jabber-tee/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #say(message) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jabber-tee/client.rb', line 9 def initialize(config) @config = config @client = Jabber::Client.new(Jabber::JID.new("#{config.username}/#{config.nick}")) client.connect client.auth(config.password) if config.in_room? @muc = Jabber::MUC::SimpleMUCClient.new(client) @muc.join(Jabber::JID.new("#{config.room}/#{config.nick}")) end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/jabber-tee/client.rb', line 7 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/jabber-tee/client.rb', line 7 def config @config end |
Instance Method Details
#say(message) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jabber-tee/client.rb', line 21 def say() .chomp! if config.in_room? @muc.say() else msg = Jabber::Message.new(config.to, ) msg.type = :chat client.send(msg) end end |