# HG changeset patch # User Kim Alvefur # Date 1371324983 -3600 # Node ID cccd9f6a628d42136fec7f3bd00c4b07f1c6acc7 # Parent fe57e9332e52ad13bf531aed185028d4ea1eb3ce mod_statistics: Better detection of when running under prosody vs prosodyctl diff -r fe57e9332e52 -r cccd9f6a628d mod_statistics/mod_statistics.lua --- a/mod_statistics/mod_statistics.lua Sat Jun 15 20:16:58 2013 +0100 +++ b/mod_statistics/mod_statistics.lua Sat Jun 15 20:36:23 2013 +0100 @@ -95,7 +95,9 @@ end function module.load() - if not(prosody and prosody.full_sessions) then return; end --FIXME: hack, need a proper flag + if not(prosody and prosody.arg) then + return; + end filters.add_filter_hook(stats.filter_hook); module:add_timer(1, function () @@ -115,10 +117,7 @@ end return 1; end); - module:provides("net", { - default_port = 5782; - listener = listener; - }); + end function module.unload() filters.remove_filter_hook(stats.filter_hook); @@ -132,3 +131,11 @@ prosodytop.run(); end end + +if prosody and prosody.arg then + module:provides("net", { + default_port = 5782; + listener = listener; + private = true; + }); +end