comparison mod_muc_block_pm/mod_muc_block_pm.lua @ 5609:e469642e6a6c

mod_muc_block_pm: Allow private messages to yourself No harm in it. Beagle apparently uses it for XEP-0333 in public channels
author Kim Alvefur <zash@zash.se>
date Wed, 19 Jul 2023 16:59:16 +0200
parents c7e532ac6bf7
children 67f7df9892bb
comparison
equal deleted inserted replaced
5608:1893ae742f66 5609:e469642e6a6c
11 local to_occupant = room:get_occupant_by_nick(stanza.attr.to) 11 local to_occupant = room:get_occupant_by_nick(stanza.attr.to)
12 if to_occupant and to_occupant.role == "moderator" then 12 if to_occupant and to_occupant.role == "moderator" then
13 return -- messaging moderators is ok 13 return -- messaging moderators is ok
14 end 14 end
15 15
16 if to_occupant.bare_jid == from_occupant.bare_jid then
17 return -- to yourself is okay, used by some clients to sync read state in public channels
18 end
19
16 room:route_to_occupant(from_occupant, st.error_reply(stanza, "cancel", "policy-violation", "Private messages are disabled", room.jid)) 20 room:route_to_occupant(from_occupant, st.error_reply(stanza, "cancel", "policy-violation", "Private messages are disabled", room.jid))
17 return false; 21 return false;
18 end, 1); 22 end, 1);