aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-07-26 21:05:13 +0200
committerKim Alvefur <zash@zash.se>2019-07-26 21:05:13 +0200
commit5bd804db729d2f20a9f82bdd954b71a2b2ba4298 (patch)
tree9f56eb7ed5cfe7c9614c7df4123680b8a79ba633
parent92571bfb04cc6cdf0bdd5d634b4f3be35f4d1117 (diff)
downloadprosody-5bd804db729d2f20a9f82bdd954b71a2b2ba4298.tar.gz
prosody-5bd804db729d2f20a9f82bdd954b71a2b2ba4298.zip
mod_admin_telnet: Factor out function for collecting all c2s sessions for easier reuse
-rw-r--r--plugins/mod_admin_telnet.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index af0ac9e7..4e34455c 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -592,12 +592,16 @@ local function get_jid(session)
return jid_join("["..ip.."]:"..clientport, session.host or "["..serverip.."]:"..serverport);
end
-local function show_c2s(callback)
+local function get_c2s()
local c2s = array.collect(values(prosody.full_sessions));
c2s:append(array.collect(values(module:shared"/*/c2s/sessions")));
c2s:append(array.collect(values(module:shared"/*/bosh/sessions")));
c2s:unique();
- c2s:sort(function(a, b)
+ return c2s;
+end
+
+local function show_c2s(callback)
+ get_c2s():sort(function(a, b)
if a.host == b.host then
if a.username == b.username then
return (a.resource or "") > (b.resource or "");