summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2008-06-24 13:45:56 -0400
committerYaohan Chen <yaohan.chen@gmail.com>2008-06-24 13:46:46 -0400
commit6f9ad0ae1a89404246877bfeffe9ff4d18745b1a (patch)
treec7399b2d5f98bba9208eb8d87e2168031aaede6f /lib
parent9847384d7ec5eeaf38a6746a585fa02c22da8134 (diff)
allow multi-line (artificial) messages be delegated and handled
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/message.rb3
-rw-r--r--lib/rbot/messagemapper.rb3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb
index 97e3673a..1fb68e20 100644
--- a/lib/rbot/message.rb
+++ b/lib/rbot/message.rb
@@ -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
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb
index dd43e27c..b6125538 100644
--- a/lib/rbot/messagemapper.rb
+++ b/lib/rbot/messagemapper.rb
@@ -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