Mercurial > prosody-modules
comparison mod_muc_limits/mod_muc_limits.lua @ 3418:9be9dd434813
mod_muc_limits: Simplify bypass for affiliated users
Fixes affiliation check for service admins which are always owners but
not listed in `room._affiliations`
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 23 Dec 2018 22:52:23 +0100 |
parents | 1534d0715d35 |
children | 5e91a34b1e71 |
comparison
equal
deleted
inserted
replaced
3417:1534d0715d35 | 3418:9be9dd434813 |
---|---|
29 end | 29 end |
30 local dest_room, dest_host, dest_nick = jid_split(stanza.attr.to); | 30 local dest_room, dest_host, dest_nick = jid_split(stanza.attr.to); |
31 local room = event.room or rooms[dest_room.."@"..dest_host]; | 31 local room = event.room or rooms[dest_room.."@"..dest_host]; |
32 if not room then return; end | 32 if not room then return; end |
33 local from_jid = stanza.attr.from; | 33 local from_jid = stanza.attr.from; |
34 local occupant = room._occupants[room._jid_nick[from_jid]]; | 34 if room:get_affiliation(jid_bare(from_jid)) then |
35 if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then | |
36 module:log("debug", "Skipping stanza from affiliated user..."); | 35 module:log("debug", "Skipping stanza from affiliated user..."); |
37 return; | 36 return; |
38 elseif dest_nick and max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then | 37 elseif dest_nick and max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then |
39 module:log("debug", "Forbidding long (%d bytes) nick in %s", #dest_nick, dest_room) | 38 module:log("debug", "Forbidding long (%d bytes) nick in %s", #dest_nick, dest_room) |
40 origin.send(st.error_reply(stanza, "modify", "policy-violation", "Your nick name is too long, please use a shorter one") | 39 origin.send(st.error_reply(stanza, "modify", "policy-violation", "Your nick name is too long, please use a shorter one") |