# HG changeset patch # User Kim Alvefur # Date 1551022211 -3600 # Node ID 43f81e85cec23354eb100645e64be8fded12aa52 # Parent d935a0f0de24d550d938149f6c82eaa317e365a6 MUC: Fire an event to allow affecting decision of whether to allow a role change diff -r d935a0f0de24 -r 43f81e85cec2 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Sun Feb 24 16:18:30 2019 +0100 +++ b/plugins/muc/muc.lib.lua Sun Feb 24 16:30:11 2019 +0100 @@ -1369,6 +1369,18 @@ 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