From 1572836f8c2888742b4f65da7dc6f66735f94bc1 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 20 Feb 2007 23:01:14 +0000 Subject: [PATCH] Minor message optimizations --- lib/rbot/message.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 62ba7469..f96515ff 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -14,10 +14,11 @@ module Irc :desc => "when replying with nick put this character after the nick of the user the bot is replying to" ) - Color = "\003" Bold = "\002" Underline = "\037" Reverse = "\026" + Color = "\003" + ColorRx = /#{Color}\d\d?(?:,\d\d?)?/ # base user message class, all user messages derive from this # (a user message is defined as having a source hostmask, a target @@ -112,7 +113,7 @@ module Irc # strip mIRC colour escapes from a string def BasicUserMessage.stripcolour(string) return "" unless string - ret = string.gsub(/\cC\d\d?(?:,\d\d?)?/, "") + ret = string.gsub(ColorRx, "") #ret.tr!("\x00-\x1f", "") ret end -- 2.39.5