summaryrefslogtreecommitdiff
path: root/lib/rbot/irc.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-07-26 11:11:17 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-07-26 11:11:17 +0000
commit463627505d21d4066a93190def1921f14aacf11b (patch)
tree7c8d31fa0295cc92242ec0d1545a691007db7387 /lib/rbot/irc.rb
parent4d25b749c765dd6c2d88f3be961d3249de2c7000 (diff)
Channel methods to check for user modes, with quickies to check for op and voice
Diffstat (limited to 'lib/rbot/irc.rb')
-rw-r--r--lib/rbot/irc.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 89bf5521..206cc98f 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1336,6 +1336,21 @@ module Irc
@mode[sym.to_sym] = kl.new(self)
end
+ def modes_of(user)
+ l = []
+ @mode.map { |s, m|
+ l << s if (m.class <= UserMode and m.list[user])
+ }
+ l
+ end
+
+ def has_op?(user)
+ @mode.has_key?(:o) and @mode[:o].list[user]
+ end
+
+ def has_voice?(user)
+ @mode.has_key?(:v) and @mode[:v].list[user]
+ end
end