# HG changeset patch # User Kim Alvefur # Date 1399828323 -7200 # Node ID 1600438c0c14268d03e2541d06dcb12fea65ccfb # Parent 0205b97bb355ddcbd5a72faba8617873387673c1 mod_admin_telnet: Move generation of log tag for s2s:show() (adds it to c2s:show() too) diff -r 0205b97bb355 -r 1600438c0c14 plugins/mod_admin_telnet.lua --- a/plugins/mod_admin_telnet.lua Sun May 11 18:51:08 2014 +0200 +++ b/plugins/mod_admin_telnet.lua Sun May 11 19:12:03 2014 +0200 @@ -491,8 +491,17 @@ 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 @@ 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 @@ 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);