aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-30 21:56:21 +0100
committerKim Alvefur <zash@zash.se>2019-11-30 21:56:21 +0100
commit07645554cc8c98328ae4cae5cc2490197c6ce3f0 (patch)
treee4de327aaa8dfcbfbc8aaca4d9624a6f2ef6bf47
parent5aee95c57c0ae9d92b681f644bf841641cef93af (diff)
downloadprosody-07645554cc8c98328ae4cae5cc2490197c6ce3f0.tar.gz
prosody-07645554cc8c98328ae4cae5cc2490197c6ce3f0.zip
mod_admin_telnet: Sort hosts
Groups by domain in DNS hierarchy order or something. Why not split on '.' you ask? Well becasue that's not what I typed here. Also "[^.]" is longer than "%P".
-rw-r--r--plugins/mod_admin_telnet.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index f3ab9597..8427f811 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -964,11 +964,15 @@ function def_env.host:deactivate(hostname, reason)
return hostmanager.deactivate(hostname, reason);
end
+local function compare_hosts(a, b)
+ return a:gsub("%P", string.reverse):reverse() < b:gsub("%P", string.reverse):reverse();
+end
+
function def_env.host:list()
local print = self.session.print;
local i = 0;
local type;
- for host, host_session in iterators.sorted_pairs(prosody.hosts) do
+ for host, host_session in iterators.sorted_pairs(prosody.hosts, compare_hosts) do
i = i + 1;
type = host_session.type;
if type == "local" then