X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fmessage.rb;h=3292cb8323a1f9aad8c638c25a69059002a40fda;hb=3a70c86c98ba9ab8f329e92104a0824f6b1d1f21;hp=62ba746921c5d3ad9c3be29fbb2deaa32011a8b8;hpb=7f4e98a691ba6ee6f220fec982f17c900c929f1d;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 62ba7469..3292cb83 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 @@ -65,7 +66,7 @@ module Irc @identified = false if @msg_wants_id && @server.capabilities[:"identify-msg"] - if @message =~ /([-+])(.*)/ + if @message =~ /^([-+])(.*)/ @identified = ($1=="+") @message = $2 else @@ -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