def privmsg(m)
debug "Delegating privmsg #{m.inspect} with pluginkey #{m.plugin.inspect}"
return unless m.plugin
k = m.plugin.to_sym
if commands.has_key?(k)
p = commands[k][:botmodule]
a = commands[k][:auth]
debug "Checking auth ..."
if a.nil? || @bot.auth.allow?(a, m.source, m.replyto)
debug "Checking response ..."
if p.respond_to?("privmsg")
begin
debug "#{p.botmodule_class} #{p.name} responds"
p.privmsg(m)
rescue Exception => err
raise if err.kind_of?(SystemExit)
error report_error("#{p.botmodule_class} #{p.name} privmsg() failed:", err)
raise if err.kind_of?(BDB::Fatal)
end
debug "Successfully delegated #{m.inspect}"
return true
else
debug "#{p.botmodule_class} #{p.name} is registered, but it doesn't respond to privmsg()"
end
else
debug "#{p.botmodule_class} #{p.name} is registered, but #{m.source} isn't allowed to call #{m.plugin.inspect} on #{m.replyto}"
end
else
debug "Command #{k} isn't handled"
end
return false
end