# HG changeset patch # User Kim Alvefur # Date 1680941778 -7200 # Node ID 7e0bb5154f3b3a473b69ca56de45f1c1f4e6ac9d # Parent 8dd5d247f989430ffd455a58d34fa74813873e01 mod_admin_shell: Allow wildcard matches like s2s:show("*.example.com") E.g. if you want to show connections to/from a domain, including its subdomains, this is handy. diff -r 8dd5d247f989 -r 7e0bb5154f3b plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Fri Apr 07 17:18:23 2023 +0200 +++ b/plugins/mod_admin_shell.lua Sat Apr 08 10:16:18 2023 +0200 @@ -1100,7 +1100,19 @@ local function match(session) local host, remote = get_s2s_hosts(session); - return not match_jid or match_jid == "*" or host == match_jid or remote == match_jid; + if not match_jid or match_jid == "*" then + return true; + elseif host == match_jid or remote == match_jid then + return true; + elseif match_jid:sub(1, 2) == "*." then + -- (host) == *.(host) or sub(.host) == *(.host) + if host == match_jid:sub(3) or host:sub(-#match_jid + 1) == match_jid:sub(2) then + return true + elseif remote == match_jid:sub(3) or remote:sub(-#match_jid + 1) == match_jid:sub(2) then + return true + end + end + return false; end local group_by_host = true;