summaryrefslogtreecommitdiff
path: root/lib/rbot/irc.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-06 22:39:10 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-06 22:39:10 +0000
commit4d193a6c8719351147faad15e9a91d391df94952 (patch)
tree08d9de3262a5f42c010c486529b98c2bcae19992 /lib/rbot/irc.rb
parent66b0acef370cd778ce943e9b50bd8590467d43bf (diff)
New Irc Framework: methods to convert channel user modes (op, voice, etc) from mode (o, v, ...) to prefix (@, +, ...) and back
Diffstat (limited to 'lib/rbot/irc.rb')
-rw-r--r--lib/rbot/irc.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 64cfdf5a..02835b36 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1533,6 +1533,22 @@ module Irc
@capabilities = {}
end
+ # Convert a mode (o, v, h, ...) to the corresponding
+ # prefix (@, +, %, ...). See also mode_for_prefix
+ def prefix_for_mode(mode)
+ return @supports[:prefix][:prefixes][
+ @supports[:prefix][:modes].index(mode.to_sym)
+ ]
+ end
+
+ # Convert a prefix (@, +, %, ...) to the corresponding
+ # mode (o, v, h, ...). See also prefix_for_mode
+ def mode_for_prefix(pfx)
+ return @supports[:prefix][:modes][
+ @supports[:prefix][:prefixes].index(pfx.to_sym)
+ ]
+ end
+
# Resets the Channel and User list
#
def reset_lists