# HG changeset patch # User Kim Alvefur # Date 1564167913 -7200 # Node ID e4043e3928f230765372f152832a98c4dc31834d # Parent f30d505e755b45614dd3dc5585a3fb99a76c5285 mod_admin_telnet: Factor out function for collecting all c2s sessions for easier reuse diff -r f30d505e755b -r e4043e3928f2 plugins/mod_admin_telnet.lua --- a/plugins/mod_admin_telnet.lua Fri Jul 26 20:25:15 2019 +0200 +++ b/plugins/mod_admin_telnet.lua Fri Jul 26 21:05:13 2019 +0200 @@ -592,12 +592,16 @@ 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 "");