]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
ircbot.rb: server no-color modes can be configured
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 30 Jul 2008 11:08:50 +0000 (13:08 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 30 Jul 2008 11:12:12 +0000 (13:12 +0200)
lib/rbot/ircbot.rb

index 91c383a5f253a67d335826ceeb74d930adee9563..f56813386abfa307a9c4a52ca438d4a54e0b0f5f 100644 (file)
@@ -272,6 +272,10 @@ class Bot
     Config.register Config::IntegerValue.new('server.ping_timeout',
       :default => 30, :validate => Proc.new{|v| v >= 0},
       :desc => "reconnect if server doesn't respond to PING within this many seconds (set to 0 to disable)")
+    Config.register Config::ArrayValue.new('server.nocolor_modes',
+      :default => ['c'], :wizard => false,
+      :requires_restart => false,
+      :desc => "List of channel modes that require messages to be without colors")
 
     Config.register Config::StringValue.new('irc.nick', :default => "rbot",
       :desc => "IRC nickname the bot should attempt to use", :wizard => true,
@@ -929,8 +933,8 @@ class Bot
 
     multi_line = original_message.to_s.gsub(/[\r\n]+/, "\n")
 
-    # if target is a channel with +c or +C modes, strip colours
-    if where.kind_of?(Channel) and where.mode.any?('c', 'C')
+    # if target is a channel with nocolor modes, strip colours
+    if where.kind_of?(Channel) and where.mode.any?(*config['server.nocolor_modes'])
       multi_line.replace BasicUserMessage.strip_formatting(multi_line)
     end