Software /
code /
prosody
Changeset
9831:43f81e85cec2
MUC: Fire an event to allow affecting decision of whether to allow a role change
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 24 Feb 2019 16:30:11 +0100 |
parents | 9830:d935a0f0de24 |
children | 9834:a657df70cc31 |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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