aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_shell.lua36
1 files changed, 33 insertions, 3 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 62906ec0..7bff4ef3 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -833,9 +833,24 @@ function def_env.c2s:show(match_jid, colspec)
return (not match_jid) or jid:match(match_jid)
end
- print(row());
+ local group_by_host = true;
+ for _, col in ipairs(columns) do
+ if col.key == "full_jid" or col.key == "host" then
+ group_by_host = false;
+ break
+ end
+ end
+
+ if not group_by_host then print(row()); end
+ local currenthost = nil;
for _, session in ipairs(get_c2s():filter(match):sort(_sort_by_jid)) do
+ if group_by_host and session.host ~= currenthost then
+ currenthost = session.host;
+ print("#",prosody.hosts[currenthost] or "Unknown host");
+ print(row());
+ end
+
print(row(session));
end
return true;
@@ -894,11 +909,26 @@ function def_env.s2s:show(match_jid, colspec)
return not match_jid or (host or ""):match(match_jid) or (remote or ""):match(match_jid);
end
- local s2s_sessions = array(iterators.values(module:shared"/*/s2s/sessions")):filter(match):sort(_sort_s2s);
+ local group_by_host = true;
+ local currenthost = nil;
+ for _, col in ipairs(columns) do
+ if col.key == "host" then
+ group_by_host = false;
+ break
+ end
+ end
+
+ if not group_by_host then print(row()); end
- print(row());
+ local s2s_sessions = array(iterators.values(module:shared"/*/s2s/sessions")):filter(match):sort(_sort_s2s);
for _, session in ipairs(s2s_sessions) do
+ if group_by_host and currenthost ~= get_s2s_hosts(session) then
+ currenthost = get_s2s_hosts(session);
+ print("#",prosody.hosts[currenthost] or "Unknown host");
+ print(row());
+ end
+
print(row(session));
end
return true; -- TODO counts