changeset 1074:cccd9f6a628d

mod_statistics: Better detection of when running under prosody vs prosodyctl
author Kim Alvefur <zash@zash.se>
date Sat, 15 Jun 2013 20:36:23 +0100
parents fe57e9332e52
children 164ed759b1d2
files mod_statistics/mod_statistics.lua
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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