- [core_commands, plugin_commands].each { |pl|
- # We do it this way to skip creating spurious keys
- # FIXME use fetch?
- k = m.plugin.to_sym
- if pl.has_key?(k)
- p = pl[k][:botmodule]
- a = pl[k][:auth]
- else
- p = nil
- a = nil
- end
- if p
- # We check here for things that don't check themselves
- # (e.g. mapped things)
- # 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.message}"
- return true
- else
- # debug "#{p.botmodule_class} #{p.name} is registered, but it doesn't respond to privmsg()"
+ k = m.plugin.to_sym
+ if commands.has_key?(k)
+ p = commands[k][:botmodule]
+ a = commands[k][:auth]
+ # We check here for things that don't check themselves
+ # (e.g. mapped things)
+ # 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)