Changeset

7070:aab022cb8e29

mod_admin_telnet: c2s:count in less lines
author Kim Alvefur <zash@zash.se>
date Sun, 10 Jan 2016 00:00:22 +0100
parents 7069:eae5d2f1311d
children 7071:d9e620adfb64
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 1 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sat Jan 09 23:59:31 2016 +0100
+++ b/plugins/mod_admin_telnet.lua	Sun Jan 10 00:00:22 2016 +0100
@@ -568,13 +568,7 @@
 end
 
 function def_env.c2s:count(match_jid)
-	local count = 0;
-	show_c2s(function (jid, session)
-		if (not match_jid) or jid:match(match_jid) then
-			count = count + 1;
-		end
-	end);
-	return true, "Total: "..count.." clients";
+	return true, "Total: "..  iterators.count(values(module:shared"/*/c2s/sessions")) .." clients";
 end
 
 function def_env.c2s:show(match_jid, annotate)