diff options
author | Kim Alvefur <zash@zash.se> | 2014-05-11 19:12:03 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-05-11 19:12:03 +0200 |
commit | 15f84804a62ded1468b2fea9bd97f74cc0803ed2 (patch) | |
tree | 1788f9582602a86bde4b9d6df9a9ae6c9a5b345f /plugins/mod_admin_telnet.lua | |
parent | 1158b940357cb909afde16a1d26a44e1c6de8240 (diff) | |
download | prosody-15f84804a62ded1468b2fea9bd97f74cc0803ed2.tar.gz prosody-15f84804a62ded1468b2fea9bd97f74cc0803ed2.zip |
mod_admin_telnet: Move generation of log tag for s2s:show() (adds it to c2s:show() too)
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 4bf939e9..4a9f74b6 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -491,8 +491,17 @@ end function def_env.hosts:add(name) end +local function common_info(session, line) + if session.id then + line[#line+1] = "["..session.id.."]" + else + line[#line+1] = "["..session.type..(tostring(session):match("%x*$")).."]" + end +end + local function session_flags(session, line) line = line or {}; + common_info(session, line); if session.type == "c2s" then local status, priority = "unavailable", tostring(session.priority or "-"); if session.presence then @@ -520,6 +529,7 @@ end local function tls_info(session, line) line = line or {}; + common_info(session, line); if session.secure then local sock = session.conn and session.conn.socket and session.conn:socket(); if sock and sock.info then @@ -628,8 +638,7 @@ function def_env.s2s:show(match_jid, annotate) remotehost, localhost = session.from_host or "?", session.to_host or "?"; end local sess_lines = { l = localhost, r = remotehost, - annotate(session, { "", direction, remotehost or "?", - "["..session.type..tostring(session):match("[a-f0-9]*$").."]" })}; + annotate(session, { "", direction, remotehost or "?" })}; if (not match_jid) or remotehost:match(match_jid) or localhost:match(match_jid) then table.insert(s2s_list, sess_lines); |