return false if @templates.empty?
failures = []
@templates.each do |tmpl|
- options = tmpl.recognize(m)
- if options.kind_of? Failure
- failures << options
+ params = tmpl.recognize(m)
+ if params.kind_of? Failure
+ failures << params
else
action = tmpl.options[:action]
unless @parent.respond_to?(action)
auth = tmpl.options[:full_auth_path]
debug "checking auth for #{auth}"
if m.bot.auth.allow?(auth, m.source, m.replyto)
- debug "template match found and auth'd: #{action.inspect} #{options.inspect}"
+ debug "template match found and auth'd: #{action.inspect} #{params.inspect}"
if !m.in_thread and (tmpl.options[:thread] or tmpl.options[:threaded]) and
(defined? WebServiceUser and not m.source.instance_of? WebServiceUser)
# Web service: requests are handled threaded anyway and we want to
m.replied = true
Thread.new do
begin
- @parent.send(action, m, options)
+ @parent.send(action, m, params)
rescue Exception => e
error "In threaded action: #{e.message}"
debug e.backtrace.join("\n")
end
end
else
- @parent.send(action, m, options)
+ @parent.send(action, m, params)
end
return true