Class: Robut::Room
Overview
Handles connections and responses to different rooms.
Instance Attribute Summary collapse
-
#muc ⇒ Object
The MUC that wraps the Jabber Chat protocol.
-
#name ⇒ Object
The room jid.
Attributes inherited from Presence
Instance Method Summary collapse
-
#initialize(connection, room_name) ⇒ Room
constructor
A new instance of Room.
- #join ⇒ Object
-
#reply(message, to) ⇒ Object
Send
messageto the room we’re currently connected to.
Methods inherited from Presence
Constructor Details
#initialize(connection, room_name) ⇒ Room
Returns a new instance of Room.
10 11 12 13 14 |
# File 'lib/robut/room.rb', line 10 def initialize(connection, room_name) self.muc = Jabber::MUC::SimpleMUCClient.new(connection.client) self.connection = connection self.name = room_name end |
Instance Attribute Details
#muc ⇒ Object
The MUC that wraps the Jabber Chat protocol.
5 6 7 |
# File 'lib/robut/room.rb', line 5 def muc @muc end |
#name ⇒ Object
The room jid
8 9 10 |
# File 'lib/robut/room.rb', line 8 def name @name end |
Instance Method Details
#join ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/robut/room.rb', line 16 def join # Add the callback from messages that occur inside the room muc. do |time, nick, | plugins = Robut::Plugin.plugins.map { |p| p.new(self) } (plugins, time, nick, , name) end muc.join(self.name + '/' + connection.config.nick) end |
#reply(message, to) ⇒ Object
Send message to the room we’re currently connected to
27 28 29 |
# File 'lib/robut/room.rb', line 27 def reply(, to) muc.send(Jabber::Message.new(muc.room, )) end |