Diff

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
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Thu Mar 30 11:09:08 2023 +0200
+++ b/plugins/mod_admin_shell.lua	Fri Mar 31 22:01:27 2023 +0200
@@ -25,7 +25,7 @@
 local unpack = table.unpack;
 local iterators = require "prosody.util.iterators";
 local keys, values = iterators.keys, iterators.values;
-local jid_bare, jid_split, jid_join, jid_resource = import("prosody.util.jid", "bare", "prepped_split", "join", "resource");
+local jid_bare, jid_split, jid_join, jid_resource, jid_compare = import("prosody.util.jid", "bare", "prepped_split", "join", "resource", "compare");
 local set, array = require "prosody.util.set", require "prosody.util.array";
 local cert_verify_identity = require "prosody.util.x509".verify_identity;
 local envload = require "prosody.util.envload".envload;
@@ -998,7 +998,7 @@
 
 	local function match(session)
 		local jid = get_jid(session)
-		return (not match_jid) or jid == match_jid;
+		return (not match_jid) or jid_compare(jid, match_jid);
 	end
 
 	local group_by_host = true;