Sha256: dde2d6d03e9294dd56c054c90eb3de511580893d1a5c1e2fa249054991181a68
Contents?: true
Size: 879 Bytes
Versions: 1
Compression:
Stored size: 879 Bytes
Contents
# Handles connections and responses to different rooms. class Robut::Room < Robut::Presence # The MUC that wraps the Jabber Chat protocol. attr_accessor :muc # The room jid attr_accessor :name def initialize(connection, room_name) self.muc = Jabber::MUC::SimpleMUCClient.new(connection.client) self.connection = connection self.name = room_name end def join # Add the callback from messages that occur inside the room muc.on_message do |time, nick, message| plugins = Robut::Plugin.plugins.map { |p| p.new(self) } handle_message(plugins, time, nick, message) end muc.join(self.name + '/' + connection.config.nick) end # Send +message+ to the room we're currently connected to def reply(message, to) msg = Jabber::Message.new(muc.room) msg.set_xhtml_body(message) muc.send(msg) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sclemmer-robut-0.5.3 | lib/robut/room.rb |