# HG changeset patch # User Jonas Schäfer # Date 1651005729 -7200 # Node ID ae83200fb55f7f850217bea63b46842d5d008798 # Parent 08dea42a302aaef95be27fd62b0a6dbab96f2e21 mod_audit: make the extension of the module API less of a hack Thanks, Zash, for making me look at mod_http. diff -r 08dea42a302a -r ae83200fb55f mod_audit/mod_audit.lua --- a/mod_audit/mod_audit.lua Tue Apr 26 22:37:13 2022 +0200 +++ b/mod_audit/mod_audit.lua Tue Apr 26 22:42:09 2022 +0200 @@ -2,6 +2,7 @@ local time_now = os.time; local st = require "util.stanza"; +local moduleapi = require "core.moduleapi"; local host_wide_user = "@"; @@ -77,10 +78,8 @@ end end -local module_api = getmetatable(module).__index; - -function module_api:audit(user, event_type, extra) - audit(self.host, user, "mod_" .. self:get_name(), event_type, extra); +function moduleapi.audit(module, user, event_type, extra) + audit(module.host, user, "mod_" .. module:get_name(), event_type, extra); end module:hook("audit", audit, 0);