Mercurial > prosody-hg
changeset 13889:9c48d555c8a6
Merge 13.0->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 25 May 2025 15:52:14 +0200 |
| parents | 318a851cb415 (current diff) 0dd82a8f1913 (diff) |
| children | 4794fd28fb1d |
| files | |
| diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/restrict_pm.lib.lua Sat May 24 15:57:29 2025 +0200 +++ b/plugins/muc/restrict_pm.lib.lua Sun May 25 15:52:14 2025 +0200 @@ -11,15 +11,19 @@ participants = "participant"; moderators = "moderator"; members = "affiliated"; + anyone = "visitor"; }; local function get_allow_pm(room) local val = room._data.allow_pm; - return compat_map[val] or val or "visitor"; + val = compat_map[val] or val or "visitor"; + if not (val == "affiliated" or valid_roles[val]) then return "visitor"; end + return val; end local function set_allow_pm(room, val) if get_allow_pm(room) == val then return false; end + if not (val == "affiliated" or valid_roles[val]) then return false end room._data.allow_pm = val; return true; end @@ -93,8 +97,10 @@ local pmval = get_allow_pm(room); if pmval ~= "none" then - if pmval == "affiliated" and room:get_affiliation(from_occupant.bare_jid) then - return; -- Allow from affiliated users + if pmval == "affiliated" then + if room:get_affiliation(from_occupant.bare_jid) then + return; -- Allow from affiliated users + end elseif valid_roles[from_occupant.role] >= valid_roles[pmval] then module:log("debug", "Allowing PM: %s(%d) >= %s(%d)", from_occupant.role, valid_roles[from_occupant.role], pmval, valid_roles[pmval]); return; -- Allow from a permitted role
