aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-11-16 11:52:36 +0000
committerMatthew Wild <mwild1@gmail.com>2021-11-16 11:52:36 +0000
commit366126e90fa9dacc7ee9b1242d82ecd18e11cc65 (patch)
treee02ac7fa7610cb4b3e616fe27ebd5ec43d30dfb4
parent5fe5458da1ae4525df65e54a26f76fe6503b6351 (diff)
downloadprosody-366126e90fa9dacc7ee9b1242d82ecd18e11cc65.tar.gz
prosody-366126e90fa9dacc7ee9b1242d82ecd18e11cc65.zip
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.
-rw-r--r--plugins/muc/muc.lib.lua4
1 files changed, 3 insertions, 1 deletions
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