# HG changeset patch # User Marco Cirillo # Date 1325994758 0 # Node ID 39c7115be370d4891ff845b857abdd2765993fed # Parent 3d6e0e037dab188edf906114195975923ea1ea06 mod_stanza_counter_http: replaced prosody.events.add_handler with module:hook. diff -r 3d6e0e037dab -r 39c7115be370 mod_stanza_counter/mod_stanza_counter_http.lua --- a/mod_stanza_counter/mod_stanza_counter_http.lua Sun Jan 08 03:52:06 2012 +0000 +++ b/mod_stanza_counter/mod_stanza_counter_http.lua Sun Jan 08 03:52:38 2012 +0000 @@ -15,11 +15,11 @@ local function res(code, r, h) local response = { - status = code; - body = r; - } + status = code, + body = r + } - if h then response.headers = h; end + if h then response.headers = h end return response end @@ -33,7 +33,7 @@ prosody.stanza_counter.message["incoming"], prosody.stanza_counter.message["outgoing"], prosody.stanza_counter.presence["incoming"], - prosody.stanza_counter.presence["outgoing"]); + prosody.stanza_counter.presence["outgoing"]) return res(200, forge_res) else local err405 = r_err:format("405", "Only GET is supported") @@ -47,5 +47,5 @@ httpserver.new_from_config(ports, req, { base = "stanza-counter" }) end --- hook server started -module:hook("server-started", setup) +-- set it +if prosody.start_time then setup() else module:hook("server-started", setup) end