Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 11908:624c14b77bb4
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 16 Nov 2021 11:52:36 +0000 |
parent | 11907:0dc2c3530d64 |
child | 11909:b33d71c43ac0 |
comparison
equal
deleted
inserted
replaced
11907:0dc2c3530d64 | 11908:624c14b77bb4 |
---|---|
1430 affiliation = affiliation or "none"; | 1430 affiliation = affiliation or "none"; |
1431 reason = reason; | 1431 reason = reason; |
1432 previous_affiliation = target_affiliation; | 1432 previous_affiliation = target_affiliation; |
1433 data = data and data or nil; -- coerce false to nil | 1433 data = data and data or nil; -- coerce false to nil |
1434 }; | 1434 }; |
1435 if not module:fire_event("muc-pre-set-affiliation", event_data) then | 1435 |
1436 module:fire_event("muc-pre-set-affiliation", event_data); | |
1437 if event.allowed == false then | |
1436 local err = event_data.error or { type = "cancel", condition = "not-allowed" }; | 1438 local err = event_data.error or { type = "cancel", condition = "not-allowed" }; |
1437 return nil, err.type, err.condition; | 1439 return nil, err.type, err.condition; |
1438 end | 1440 end |
1439 if affiliation and not data and event_data.data then | 1441 if affiliation and not data and event_data.data then |
1440 -- Allow handlers to add data when none was going to be set | 1442 -- Allow handlers to add data when none was going to be set |