Software /
code /
prosody-modules
Diff
mod_client_management/mod_client_management.lua @ 5308:f370ccb15f05
mod_client_management: Fix user:clients() shell command to take a JID
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 06 Apr 2023 15:21:09 +0100 |
parent | 5307:2bb27dfd10d5 |
child | 5309:09656e2b4927 |
line wrap: on
line diff
--- a/mod_client_management/mod_client_management.lua Thu Apr 06 15:20:25 2023 +0100 +++ b/mod_client_management/mod_client_management.lua Thu Apr 06 15:21:09 2023 +0100 @@ -375,8 +375,15 @@ local console_env = module:shared("/*/admin_shell/env"); if not console_env.user then return; end -- admin_shell probably not loaded - function console_env.user:clients(username) - local clients = get_active_clients(username); + function console_env.user:clients(user_jid) + local username, host = jid.split(user_jid); + local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management; + if not mod then + print("EE: Host does not exist on this server, or does not have mod_client_management loaded"); + return 1; + end + + local clients = mod.get_active_clients(username); if not clients or #clients == 0 then return true, "No clients associated with this account"; end