summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/irc.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 2eb676e2..19ea3370 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -4,6 +4,8 @@
# Channels is the User on (of those the client is on too)?
# We may want this so that when a User leaves all Channels and he hasn't
# sent us privmsgs, we know we can remove him from the Server @users list
+# FIXME for the time being, we do it with a method that scans the server
+# (if defined), so the method is slow and should not be used frequently.
# * Maybe ChannelList and UserList should be HashesOf instead of ArrayOf?
# See items marked as TODO Ho.
# The framework to do this is now in place, thanks to the new [] method
@@ -1041,6 +1043,14 @@ module Irc
raise "Can't resolve channel #{channel}"
end
end
+
+ def channels
+ if @server
+ @server.channels.select { |ch| ch.has_user?(self) }
+ else
+ Array.new
+ end
+ end
end