Software /
code /
prosody
Changeset
12906:e282c92ded0e
core.usermanager: Fire events when enabling and disabling users
Allow modules to act on this state change, e.g. kick accounts etc.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 23 Feb 2023 16:25:31 +0100 |
parents | 12905:8473a516004f |
children | 12907:d2333b468d07 |
files | core/usermanager.lua |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/core/usermanager.lua Thu Feb 23 16:24:41 2023 +0100 +++ b/core/usermanager.lua Thu Feb 23 16:25:31 2023 +0100 @@ -155,13 +155,21 @@ local function enable_user(username, host) local method = hosts[host].users.enable; if not method then return nil, "method-not-supported"; end - return method(username); + local ret, err = method(username); + if ret then + prosody.events.fire_event("user-enabled", { username = username, host = host }); + end + return ret, err; end local function disable_user(username, host) local method = hosts[host].users.disable; if not method then return nil, "method-not-supported"; end - return method(username); + local ret, err = method(username); + if ret then + prosody.events.fire_event("user-disabled", { username = username, host = host }); + end + return ret, err; end local function users(host)