From 12da21e1b07b79f4e72902b5da27550d9051d691 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 17 May 2013 14:56:06 +0200 Subject: mod_admin_telnet: List session flags (encryption, compression etc) the same way for c2s as s2s --- plugins/mod_admin_telnet.lua | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'plugins/mod_admin_telnet.lua') 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) -- cgit v1.2.3