summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-30 13:08:50 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-30 13:12:12 +0200
commit7b536059aaf8fead11667d6ecf79d57b69271f6a (patch)
tree21d3c44a1cf445e59ac33419c44bb81de54ac77a
parentb6e6d0c78156e3fe16a011007c7f4314e442619a (diff)
ircbot.rb: server no-color modes can be configured
-rw-r--r--lib/rbot/ircbot.rb8
1 files changed, 6 insertions, 2 deletions
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