# HG changeset patch # User Marco Cirillo # Date 1328748738 0 # Node ID 03be4622454fbb0474ad8b12cb32e48033c3fcae # Parent 7df0d5c8abfdd155c5bb119cdb7a0cfe6c974746 mod_stanza_counter_http: de-revert to use configmanager instead of module mm for the cleanup function also give it an unique name (mismatch possible "??") diff -r 7df0d5c8abfd -r 03be4622454f mod_stanza_counter/mod_stanza_counter_http.lua --- a/mod_stanza_counter/mod_stanza_counter_http.lua Thu Feb 09 00:47:01 2012 +0000 +++ b/mod_stanza_counter/mod_stanza_counter_http.lua Thu Feb 09 00:52:18 2012 +0000 @@ -44,7 +44,7 @@ -- initialization. -- init http and cleanup interface -function cleanup() -- recycled from mod_register_json, it's handy +function sc_cleanup() -- recycled from mod_register_json, it's handy module:log("debug", "Cleaning up handlers and stuff as module is being unloaded.") for _, options in ipairs(ports) do if options.port then @@ -53,7 +53,7 @@ end -- if there are no handlers left clean and close the socket, doesn't work with server_event - local event = module:get_option_boolen("use_libevent", false) + local event = require "core.configmanager".get("*", "core", "use_libevent") if not event then for _, options in ipairs(ports) do @@ -68,12 +68,12 @@ end end - prosody.events.remove_handler("module-unloaded", cleanup) + prosody.events.remove_handler("module-unloaded", sc_cleanup) end local function setup() httpserver.new_from_config(ports, req, { base = "stanza-counter" }) - prosody.events.add_handler("module-unloaded", cleanup) + prosody.events.add_handler("module-unloaded", sc_cleanup) end -- set it