summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-11-01 09:52:30 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-11-01 10:36:54 +0100
commitc1e2c7ff8a856bf606959a260023b815dcded3f6 (patch)
tree3f82bf9cf4338cfad9865335f5b4cbf073b78876 /lib
parent34ca2ba507e4246f1bc1851b04d2ecdffd433a19 (diff)
IRC Framework: Channel.npname()
Returns the unprefixed part of a channel name
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/irc.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index c893fc27..ebfbaed3 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1323,6 +1323,13 @@ module Irc
#
class Channel
+ # Return the non-prefixed part of a channel name.
+ # Also works with ## channels found on some networks
+ # (e.g. FreeNode)
+ def self.npname(str)
+ return str.to_s.sub(/^[&#+!]+/,'')
+ end
+
include ServerOrCasemap
attr_reader :name, :topic, :mode, :users
alias :to_s :name