aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-05-17 14:56:06 +0200
committerKim Alvefur <zash@zash.se>2013-05-17 14:56:06 +0200
commit12da21e1b07b79f4e72902b5da27550d9051d691 (patch)
treed46840d1c94ec77f15d629c01b769d0ea555ed62
parenta4bd217da1874b9e0837bbda638d7b42eeb7a0e2 (diff)
downloadprosody-12da21e1b07b79f4e72902b5da27550d9051d691.tar.gz
prosody-12da21e1b07b79f4e72902b5da27550d9051d691.zip
mod_admin_telnet: List session flags (encryption, compression etc) the same way for c2s as s2s
-rw-r--r--plugins/mod_admin_telnet.lua38
1 files changed, 20 insertions, 18 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index b67ba576..08fe57c0 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -484,6 +484,25 @@ end
function def_env.hosts:add(name)
end
+local function session_flags(session, line)
+ line = line or {};
+ if session.cert_identity_status == "valid" then
+ line[#line+1] = "(secure)";
+ elseif session.secure then
+ line[#line+1] = "(encrypted)";
+ end
+ if session.compressed then
+ line[#line+1] = "(compressed)";
+ end
+ if session.smacks then
+ line[#line+1] = "(sm)";
+ end
+ if (session.ip or session.conn and session.conn:ip()):match(":") then
+ line[#line+1] = "(IPv6)";
+ end
+ return table.concat(line, " ");
+end
+
def_env.c2s = {};
local function show_c2s(callback)
@@ -526,7 +545,7 @@ function def_env.c2s:show(match_jid)
status = "available";
end
end
- print(" "..jid.." - "..status.."("..priority..")");
+ print(session_flags(session, { " "..jid.." - "..status.."("..priority..")" }));
end
end);
return true, "Total: "..count.." clients";
@@ -565,23 +584,6 @@ 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)";
- elseif session.secure then
- line[#line+1] = "(encrypted)";
- end
- if session.compressed then
- line[#line+1] = "(compressed)";
- end
- if session.smacks then
- line[#line+1] = "(sm)";
- end
- if session.conn and session.conn:ip():match(":") then
- line[#line+1] = "(IPv6)";
- end
- return table.concat(line, " ");
-end
def_env.s2s = {};
function def_env.s2s:show(match_jid)