# HG changeset patch # User Kim Alvefur # Date 1701514099 -3600 # Node ID 08a63586220160e9ce82d95c532008e2bfe4c50c # Parent e199f33f7a2e9545d5db2a29657111ab0e473bca mod_audit: Update command to handle storing JIDs instead of only usernames diff -r e199f33f7a2e -r 08a635862201 mod_audit/mod_audit.lua --- a/mod_audit/mod_audit.lua Sat Dec 02 11:18:57 2023 +0100 +++ b/mod_audit/mod_audit.lua Sat Dec 02 11:48:19 2023 +0100 @@ -172,7 +172,8 @@ }); module:log("debug", "arg = %q", arg); - local query_user, host = jid.prepped_split(arg[1]); + local query_jid = jid.prep(arg[1]); + local host = jid.host(query_jid); if arg.prune then local sm = require "core.storagemanager"; @@ -201,14 +202,16 @@ local c = 0; if arg.global then - if query_user then + if jid.node(query_jid) then print("WW: Specifying a user account is incompatible with --global. Showing only global events."); end - query_user = "@"; + query_jid = "@"; + elseif host == query_jid then + query_jid = "@"; end local results, err = store:find(nil, { - with = query_user; + with = query_jid; limit = arg.limit and tonumber(arg.limit) or nil; reverse = true; }) @@ -223,7 +226,7 @@ { title = "Event", key = "event_type", width = "2p" }; }; - if arg.show_user ~= false and (not arg.global and not query_user) or arg.show_user then + if arg.show_user ~= false and (not arg.global and not query_jid) or arg.show_user then table.insert(colspec, { title = "User", key = "username", width = "2p", mapper = function (user)