X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Fircbot.rb;h=f56813386abfa307a9c4a52ca438d4a54e0b0f5f;hb=7b536059aaf8fead11667d6ecf79d57b69271f6a;hp=91c383a5f253a67d335826ceeb74d930adee9563;hpb=b6e6d0c78156e3fe16a011007c7f4314e442619a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 91c383a5..f5681338 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -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