From 366126e90fa9dacc7ee9b1242d82ecd18e11cc65 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 16 Nov 2021 11:52:36 +0000 Subject: MUC: Switch to event.allowed signaling to block event, matching muc-pre-set-role ...and fixing the logic bug that broke everything in the previous commit. --- plugins/muc/muc.lib.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index e7ebd65d..8d8fb2c1 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -1432,7 +1432,9 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason, data) previous_affiliation = target_affiliation; data = data and data or nil; -- coerce false to nil }; - if not module:fire_event("muc-pre-set-affiliation", event_data) then + + module:fire_event("muc-pre-set-affiliation", event_data); + if event.allowed == false then local err = event_data.error or { type = "cancel", condition = "not-allowed" }; return nil, err.type, err.condition; end -- cgit v1.2.3