]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
allow multi-line (artificial) messages be delegated and handled
authorYaohan Chen <yaohan.chen@gmail.com>
Tue, 24 Jun 2008 17:45:56 +0000 (13:45 -0400)
committerYaohan Chen <yaohan.chen@gmail.com>
Tue, 24 Jun 2008 17:46:46 +0000 (13:46 -0400)
lib/rbot/message.rb
lib/rbot/messagemapper.rb

index 97e3673a9e5aa9320fb1ba33cc2aa42377aa68a8..1fb68e2003a47b5235ba2c0093ad55449a9f40cc 100644 (file)
@@ -328,7 +328,8 @@ module Irc
 
       # free splitting for plugins
       @params = @message.dup
-      if @params.gsub!(/^\s*(\S+)[\s$]*/, "")
+      # Created messges (such as by fake_message) can contain multiple lines
+      if @params.gsub!(/\A\s*(\S+)[\s$]*/m, "")
         @plugin = $1.downcase
         @params = nil unless @params.length > 0
       end
index dd43e27c5325dd1efce8dadc3d7e00146a5d558a..b6125538b49b1ba24be54ead551c42b9511181f6 100644 (file)
@@ -519,7 +519,8 @@ class Bot
       # debug "Delimited optionals: #{rx.inspect}"
       rx.gsub!(/(?:\\ )+/, "\\s+")
       # debug "Corrected spaces: #{rx.inspect}"
-      @regexp = Regexp.new("^#{rx}$")
+      # Created message (such as by fake_message) can contain multiple lines
+      @regexp = /\A#{rx}\z/m
     end
 
     # Recognize the provided string components, returning a hash of