aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-04-28 17:18:03 +0200
committerKim Alvefur <zash@zash.se>2012-04-28 17:18:03 +0200
commitad6b4cd46567245baf4d280e9e3f9dfbdf7fee23 (patch)
tree3c02d183475f85af796fde09aff748e2694d6af7
parente8d147c96a9cf84cae6a957adc16cb0a9cd11360 (diff)
downloadprosody-ad6b4cd46567245baf4d280e9e3f9dfbdf7fee23.tar.gz
prosody-ad6b4cd46567245baf4d280e9e3f9dfbdf7fee23.zip
mod_admin_telnet: Add c2s:count() which shows number of connected users.
-rw-r--r--plugins/mod_admin_telnet.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 202170ba..544ea161 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -440,6 +440,16 @@ local function show_c2s(callback)
end
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";
+end
+
function def_env.c2s:show(match_jid)
local print, count = self.session.print, 0;
local curr_host;