Mercurial > prosody-hg
comparison plugins/mod_admin_shell.lua @ 13053:8128c4f1b08b
mod_admin_shell: Allow "*" as substitute for 'nil' for easier CLI usage
Since prosodyctl shell with additional arguments assumes the first two
are a section:command() and any following arguments are strings, passing
a bare 'nil' is not possible. In order to avoid delving into this rabbit
hole, instead produce a token that alone is not really a legal JID for
use as wildcard.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 07 Apr 2023 14:03:24 +0200 |
| parents | d4f7118d1531 |
| children | 7e0bb5154f3b |
comparison
equal
deleted
inserted
replaced
| 13052:585bd71a1a97 | 13053:8128c4f1b08b |
|---|---|
| 1015 local columns = get_colspec(colspec, { "id"; "jid"; "role"; "ipv"; "status"; "secure"; "smacks"; "csi" }); | 1015 local columns = get_colspec(colspec, { "id"; "jid"; "role"; "ipv"; "status"; "secure"; "smacks"; "csi" }); |
| 1016 local row = format_table(columns, self.session.width); | 1016 local row = format_table(columns, self.session.width); |
| 1017 | 1017 |
| 1018 local function match(session) | 1018 local function match(session) |
| 1019 local jid = get_jid(session) | 1019 local jid = get_jid(session) |
| 1020 return (not match_jid) or jid_compare(jid, match_jid); | 1020 return (not match_jid) or match_jid == "*" or jid_compare(jid, match_jid); |
| 1021 end | 1021 end |
| 1022 | 1022 |
| 1023 local group_by_host = true; | 1023 local group_by_host = true; |
| 1024 for _, col in ipairs(columns) do | 1024 for _, col in ipairs(columns) do |
| 1025 if col.key == "full_jid" or col.key == "host" then | 1025 if col.key == "full_jid" or col.key == "host" then |
| 1098 local columns = get_colspec(colspec, { "id"; "host"; "dir"; "remote"; "ipv"; "secure"; "s2s_sasl"; "dialback" }); | 1098 local columns = get_colspec(colspec, { "id"; "host"; "dir"; "remote"; "ipv"; "secure"; "s2s_sasl"; "dialback" }); |
| 1099 local row = format_table(columns, self.session.width); | 1099 local row = format_table(columns, self.session.width); |
| 1100 | 1100 |
| 1101 local function match(session) | 1101 local function match(session) |
| 1102 local host, remote = get_s2s_hosts(session); | 1102 local host, remote = get_s2s_hosts(session); |
| 1103 return not match_jid or host == match_jid or remote == match_jid; | 1103 return not match_jid or match_jid == "*" or host == match_jid or remote == match_jid; |
| 1104 end | 1104 end |
| 1105 | 1105 |
| 1106 local group_by_host = true; | 1106 local group_by_host = true; |
| 1107 local currenthost = nil; | 1107 local currenthost = nil; |
| 1108 for _, col in ipairs(columns) do | 1108 for _, col in ipairs(columns) do |
