Sha256: 0eb291f1b5c2e0d6a9c571380d82ab9c7859e9412d41490d594cdf3cc1780d57
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
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) if message =~ /</ msg.xhtml_body = message else msg.body = message end $stderr.puts 'msg: %s' % msg.inspect $stderr.puts 'msg.body: %s' % msg.body.inspect $stderr.puts 'msg.xhtml_body: %s' % msg.xhtml_body.inspect muc.send(msg) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sclemmer-robut-0.5.4 | lib/robut/room.rb |