Comparison

plugins/mod_admin_telnet.lua @ 5709:5557b4a4cb49

mod_admin_telnet: Generate session names the same way as in s2smanager
author Kim Alvefur <zash@zash.se>
date Thu, 20 Jun 2013 21:47:28 +0200
parent 5708:667cf4e45356
child 5710:e66bbfdf588e
comparison
equal deleted inserted replaced
5708:667cf4e45356 5709:5557b4a4cb49
786 elseif from == to then 786 elseif from == to then
787 return false, "Both from and to are the same... you can't do that :)"; 787 return false, "Both from and to are the same... you can't do that :)";
788 end 788 end
789 789
790 for _, session in pairs(s2s_sessions) do 790 for _, session in pairs(s2s_sessions) do
791 local id = session.type..tostring(session):sub(10); 791 local id = session.type..tostring(session):match("[a-f0-9]+$");
792 if (match_id and match_id == id) 792 if (match_id and match_id == id)
793 or (session.from_host == from and session.to_host == to) then 793 or (session.from_host == from and session.to_host == to) then
794 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); 794 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id));
795 (session.close or s2smanager.destroy_session)(session); 795 (session.close or s2smanager.destroy_session)(session);
796 count = count + 1 ; 796 count = count + 1 ;