lib/robut/connection.rb in robut-0.4.0 vs lib/robut/connection.rb in robut-0.5.0

- old
+ new

@@ -83,20 +83,27 @@ client.send(Jabber::Presence.new.set_type(:available)) self.roster = Jabber::Roster::Helper.new(client) roster.wait_for_roster - rooms = self.config.rooms.collect do |room_name| + self.rooms = self.config.rooms.collect do |room_name| Robut::Room.new(self, room_name).tap {|r| r.join } end personal_message = Robut::PM.new(self, rooms) trap_signals - loop { sleep 1 } + self end + # Send a message to all rooms. + def reply(*args, &block) + self.rooms.each do |room| + room.reply(*args, &block) + end + end + private # Since we're entering an infinite loop, we have to trap TERM and # INT. If something like the Rdio plugin has started a server that # has already trapped those signals, we want to run those signal # handlers first. @@ -109,6 +116,6 @@ [:INT, :TERM].each do |sig| old_signal_callbacks[sig] = trap(sig) { signal_callback.call(sig) } end end -end \ No newline at end of file +end