aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-03-05 22:07:40 +0100
committerKim Alvefur <zash@zash.se>2012-03-05 22:07:40 +0100
commit1758d8c92c1915af55e037972069a618e207497e (patch)
treeb670b2dc9d593d3a13abb64ff58314d65e4cd10b /plugins
parent5442ecd0fee91a236bbdacd1ed631398b4bb0c33 (diff)
downloadprosody-1758d8c92c1915af55e037972069a618e207497e.tar.gz
prosody-1758d8c92c1915af55e037972069a618e207497e.zip
mod_admin_telnet: Commond and flexible way to show stream properties.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_telnet.lua17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index b211d271..b96f69b9 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -487,6 +487,19 @@ function def_env.c2s:close(match_jid)
return true, "Total: "..count.." sessions closed";
end
+local function session_flags(session, line)
+ if session.cert_identity_status == "valid" then
+ line[#line+1] = "(secure)";
+ end
+ if session.secure then
+ line[#line+1] = "(encrypted)";
+ end
+ if session.compressed then
+ line[#line+1] = "(compressed)";
+ end
+ return table.concat(line, " ");
+end
+
def_env.s2s = {};
function def_env.s2s:show(match_jid)
local _print = self.session.print;
@@ -499,7 +512,7 @@ function def_env.s2s:show(match_jid)
for remotehost, session in pairs(host_session.s2sout) do
if (not match_jid) or remotehost:match(match_jid) or host:match(match_jid) then
count_out = count_out + 1;
- print(" "..host.." -> "..remotehost..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or ""));
+ print(session_flags(session, {" ", host, "->", remotehost}));
if session.sendq then
print(" There are "..#session.sendq.." queued outgoing stanzas for this connection");
end
@@ -536,7 +549,7 @@ function def_env.s2s:show(match_jid)
-- Pft! is what I say to list comprehensions
or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then
count_in = count_in + 1;
- print(" "..host.." <- "..(session.from_host or "(unknown)")..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or ""));
+ print(session_flags(session, {" ", host, "<-", session.from_host or "(unknown)"}));
if session.type == "s2sin_unauthed" then
print(" Connection not yet authenticated");
end