Changeset

600:03be4622454f

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 "??")
author Marco Cirillo <maranda@lightwitch.org>
date Thu, 09 Feb 2012 00:52:18 +0000
parents 599:7df0d5c8abfd
children 601:00590d492a5b
files mod_stanza_counter/mod_stanza_counter_http.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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