summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-20 23:01:14 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-20 23:01:14 +0000
commit1572836f8c2888742b4f65da7dc6f66735f94bc1 (patch)
treebe4c63a2ffd32ca5d63a484c4e623d04010a1472 /lib
parent9de021c3914d540ef1c693172ac574ae71cd4984 (diff)
Minor message optimizations
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/message.rb5
1 files 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