Mercurial > prosody-modules
comparison mod_client_management/mod_client_management.lua @ 5372:2d8076577e14
mod_client_management: Fix error when called against host without this module
Previously:
prosody> user:clients("user@example.org")
| Result: 1
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Apr 2023 12:09:17 +0200 |
parents | b2d51c6ae89a |
children | 93d6ed7dc779 |
comparison
equal
deleted
inserted
replaced
5371:b2d51c6ae89a | 5372:2d8076577e14 |
---|---|
407 | 407 |
408 function console_env.user:clients(user_jid) | 408 function console_env.user:clients(user_jid) |
409 local username, host = jid.split(user_jid); | 409 local username, host = jid.split(user_jid); |
410 local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management; | 410 local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management; |
411 if not mod then | 411 if not mod then |
412 print("EE: Host does not exist on this server, or does not have mod_client_management loaded"); | 412 return false, ("Host does not exist on this server, or does not have mod_client_management loaded"); |
413 return 1; | |
414 end | 413 end |
415 | 414 |
416 local clients = mod.get_active_clients(username); | 415 local clients = mod.get_active_clients(username); |
417 if not clients or #clients == 0 then | 416 if not clients or #clients == 0 then |
418 return true, "No clients associated with this account"; | 417 return true, "No clients associated with this account"; |