Comparison

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
comparison
equal deleted inserted replaced
5307:2bb27dfd10d5 5308:f370ccb15f05
373 373
374 module:once(function () 374 module:once(function ()
375 local console_env = module:shared("/*/admin_shell/env"); 375 local console_env = module:shared("/*/admin_shell/env");
376 if not console_env.user then return; end -- admin_shell probably not loaded 376 if not console_env.user then return; end -- admin_shell probably not loaded
377 377
378 function console_env.user:clients(username) 378 function console_env.user:clients(user_jid)
379 local clients = get_active_clients(username); 379 local username, host = jid.split(user_jid);
380 local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management;
381 if not mod then
382 print("EE: Host does not exist on this server, or does not have mod_client_management loaded");
383 return 1;
384 end
385
386 local clients = mod.get_active_clients(username);
380 if not clients or #clients == 0 then 387 if not clients or #clients == 0 then
381 return true, "No clients associated with this account"; 388 return true, "No clients associated with this account";
382 end 389 end
383 390
384 local colspec = { 391 local colspec = {