aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-02-23 16:25:31 +0100
committerKim Alvefur <zash@zash.se>2023-02-23 16:25:31 +0100
commitbb65a83696d7afb320bddbd38ef8480c0e3f5a6a (patch)
tree21d2e754fd7508e22dacc8a2478d68be8eb44758 /core
parent931c14e50b186f65c2f57309147dda54d12bb02a (diff)
downloadprosody-bb65a83696d7afb320bddbd38ef8480c0e3f5a6a.tar.gz
prosody-bb65a83696d7afb320bddbd38ef8480c0e3f5a6a.zip
core.usermanager: Fire events when enabling and disabling users
Allow modules to act on this state change, e.g. kick accounts etc.
Diffstat (limited to 'core')
-rw-r--r--core/usermanager.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 439d4a8b..3afb5037 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -155,13 +155,21 @@ end
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)