Mercurial > prosody-modules
changeset 1132:832235cc1910
mod_telnet_tlsinfo: Add a pattern argument similar to s2s:show(pattern) for limiting output
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 07 Aug 2013 11:13:54 +0200 (2013-08-07) |
parents | e7b69d12fbfb |
children | 11e2598baafb |
files | mod_telnet_tlsinfo/mod_telnet_tlsinfo.lua |
diffstat | 1 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_telnet_tlsinfo/mod_telnet_tlsinfo.lua Sun Aug 04 18:12:52 2013 +0200 +++ b/mod_telnet_tlsinfo/mod_telnet_tlsinfo.lua Wed Aug 07 11:13:54 2013 +0200 @@ -18,24 +18,28 @@ end end -function console_env.c2s:showtls() +function console_env.c2s:showtls(pat) local print = self.session.print; for _, session in pairs(c2s_sessions) do - print(session.full_jid or "unauthenticated") - print_tlsinfo(print, session); - print"" + if not pat or session.full_jid and session.full_jid:find(pat, nil, true) then + print(session.full_jid or "unauthenticated") + print_tlsinfo(print, session); + print"" + end end end -function console_env.s2s:showtls() +function console_env.s2s:showtls(pat) local print = self.session.print; for _, session in pairs(s2s_sessions) do - if session.direction == "outgoing" then - print(session.from_host, "->", session.to_host) - else - print(session.to_host, "<-", session.from_host) + if not pat or session.from_host == pat or session.to_host == pat then + if session.direction == "outgoing" then + print(session.from_host, "->", session.to_host) + else + print(session.to_host, "<-", session.from_host) + end + print_tlsinfo(print, session); + print"" end - print_tlsinfo(print, session); - print"" end end