Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 13013:430333198e4c
mod_admin_shell: Allow matching on host or bare JID in c2s:show
Only supporting exact match on full JID isn't helpful if you want to
list sessions per host or user.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 31 Mar 2023 22:01:27 +0200 |
parent | 12993:623fbb5f9b05 |
child | 13034:1387888a5596 |
comparison
equal
deleted
inserted
replaced
13012:c2616274bef7 | 13013:430333198e4c |
---|---|
23 local prosody = _G.prosody; | 23 local prosody = _G.prosody; |
24 | 24 |
25 local unpack = table.unpack; | 25 local unpack = table.unpack; |
26 local iterators = require "prosody.util.iterators"; | 26 local iterators = require "prosody.util.iterators"; |
27 local keys, values = iterators.keys, iterators.values; | 27 local keys, values = iterators.keys, iterators.values; |
28 local jid_bare, jid_split, jid_join, jid_resource = import("prosody.util.jid", "bare", "prepped_split", "join", "resource"); | 28 local jid_bare, jid_split, jid_join, jid_resource, jid_compare = import("prosody.util.jid", "bare", "prepped_split", "join", "resource", "compare"); |
29 local set, array = require "prosody.util.set", require "prosody.util.array"; | 29 local set, array = require "prosody.util.set", require "prosody.util.array"; |
30 local cert_verify_identity = require "prosody.util.x509".verify_identity; | 30 local cert_verify_identity = require "prosody.util.x509".verify_identity; |
31 local envload = require "prosody.util.envload".envload; | 31 local envload = require "prosody.util.envload".envload; |
32 local envloadfile = require "prosody.util.envload".envloadfile; | 32 local envloadfile = require "prosody.util.envload".envloadfile; |
33 local has_pposix, pposix = pcall(require, "prosody.util.pposix"); | 33 local has_pposix, pposix = pcall(require, "prosody.util.pposix"); |
996 local columns = get_colspec(colspec, { "id"; "jid"; "role"; "ipv"; "status"; "secure"; "smacks"; "csi" }); | 996 local columns = get_colspec(colspec, { "id"; "jid"; "role"; "ipv"; "status"; "secure"; "smacks"; "csi" }); |
997 local row = format_table(columns, self.session.width); | 997 local row = format_table(columns, self.session.width); |
998 | 998 |
999 local function match(session) | 999 local function match(session) |
1000 local jid = get_jid(session) | 1000 local jid = get_jid(session) |
1001 return (not match_jid) or jid == match_jid; | 1001 return (not match_jid) or jid_compare(jid, match_jid); |
1002 end | 1002 end |
1003 | 1003 |
1004 local group_by_host = true; | 1004 local group_by_host = true; |
1005 for _, col in ipairs(columns) do | 1005 for _, col in ipairs(columns) do |
1006 if col.key == "full_jid" or col.key == "host" then | 1006 if col.key == "full_jid" or col.key == "host" then |