aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-02-24 16:30:11 +0100
committerKim Alvefur <zash@zash.se>2019-02-24 16:30:11 +0100
commit8518868d4192e48f1f7529970dca3bae4364f43b (patch)
tree26c5416846b136b5ddb51a927ff9705caf9843e3
parent10e58af1abd74cd1bb668fc75b506b57fd77d86f (diff)
downloadprosody-8518868d4192e48f1f7529970dca3bae4364f43b.tar.gz
prosody-8518868d4192e48f1f7529970dca3bae4364f43b.zip
MUC: Fire an event to allow affecting decision of whether to allow a role change
-rw-r--r--plugins/muc/muc.lib.lua12
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