diff options
author | Kim Alvefur <zash@zash.se> | 2019-02-24 16:30:11 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-02-24 16:30:11 +0100 |
commit | 4b80adc9641fca202ab7e2488722280932b44ad2 (patch) | |
tree | 26c5416846b136b5ddb51a927ff9705caf9843e3 /plugins/muc/muc.lib.lua | |
parent | 344b370b5e6367761a32da79587ad02a15604845 (diff) | |
download | prosody-4b80adc9641fca202ab7e2488722280932b44ad2.tar.gz prosody-4b80adc9641fca202ab7e2488722280932b44ad2.zip |
MUC: Fire an event to allow affecting decision of whether to allow a role change
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r-- | plugins/muc/muc.lib.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 2b6a7d76..a8d3d790 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -1369,6 +1369,18 @@ function room_mt:get_role(nick) end function room_mt:may_set_role(actor, occupant, role) + local event = { + room = self, + actor = actor, + occupant = occupant, + role = role, + }; + + module:fire_event("muc-pre-set-role", event); + if event.allowed ~= nil then + return event.allowed, event.error, event.condition; + end + -- Can't do anything to other owners or admins local occupant_affiliation = self:get_affiliation(occupant.bare_jid); if occupant_affiliation == "owner" or occupant_affiliation == "admin" then |