Comparison

plugins/mod_admin_telnet.lua @ 7069:eae5d2f1311d

mod_admin_telnet: Show unauthenticated clients identified by local/remote IP and port
author Kim Alvefur <zash@zash.se>
date Sat, 09 Jan 2016 23:59:31 +0100
parent 7068:0c494bca43cb
child 7070:aab022cb8e29
comparison
equal deleted inserted replaced
7068:0c494bca43cb 7069:eae5d2f1311d
541 541
542 local function get_jid(session) 542 local function get_jid(session)
543 if session.username then 543 if session.username then
544 return session.full_jid or jid_join(session.username, session.host, session.resource); 544 return session.full_jid or jid_join(session.username, session.host, session.resource);
545 end 545 end
546 return "(unknown)"; 546
547 local conn = session.conn;
548 local ip = session.ip or "?";
549 local clientport = conn and conn:clientport() or "?";
550 local serverip = conn and conn.server and conn:server():ip() or "?";
551 local serverport = conn and conn:serverport() or "?"
552 return jid_join("["..ip.."]:"..clientport, session.host or "["..serverip.."]:"..serverport);
547 end 553 end
548 554
549 local function show_c2s(callback) 555 local function show_c2s(callback)
550 local c2s = array.collect(values(module:shared"/*/c2s/sessions")); 556 local c2s = array.collect(values(module:shared"/*/c2s/sessions"));
551 c2s:sort(function(a, b) 557 c2s:sort(function(a, b)