Software /
code /
prosody-modules
Comparison
mod_telnet_tlsinfo/mod_telnet_tlsinfo.lua @ 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 |
parent | 1087:447af80a16ad |
comparison
equal
deleted
inserted
replaced
1131:e7b69d12fbfb | 1132:832235cc1910 |
---|---|
16 else | 16 else |
17 print(("%20s: %s"):format("protocol", "TCP")) | 17 print(("%20s: %s"):format("protocol", "TCP")) |
18 end | 18 end |
19 end | 19 end |
20 | 20 |
21 function console_env.c2s:showtls() | 21 function console_env.c2s:showtls(pat) |
22 local print = self.session.print; | 22 local print = self.session.print; |
23 for _, session in pairs(c2s_sessions) do | 23 for _, session in pairs(c2s_sessions) do |
24 print(session.full_jid or "unauthenticated") | 24 if not pat or session.full_jid and session.full_jid:find(pat, nil, true) then |
25 print_tlsinfo(print, session); | 25 print(session.full_jid or "unauthenticated") |
26 print"" | 26 print_tlsinfo(print, session); |
27 print"" | |
28 end | |
27 end | 29 end |
28 end | 30 end |
29 | 31 |
30 function console_env.s2s:showtls() | 32 function console_env.s2s:showtls(pat) |
31 local print = self.session.print; | 33 local print = self.session.print; |
32 for _, session in pairs(s2s_sessions) do | 34 for _, session in pairs(s2s_sessions) do |
33 if session.direction == "outgoing" then | 35 if not pat or session.from_host == pat or session.to_host == pat then |
34 print(session.from_host, "->", session.to_host) | 36 if session.direction == "outgoing" then |
35 else | 37 print(session.from_host, "->", session.to_host) |
36 print(session.to_host, "<-", session.from_host) | 38 else |
39 print(session.to_host, "<-", session.from_host) | |
40 end | |
41 print_tlsinfo(print, session); | |
42 print"" | |
37 end | 43 end |
38 print_tlsinfo(print, session); | |
39 print"" | |
40 end | 44 end |
41 end | 45 end |