mod_muc_block_pm: Allow private messages to yourself
authorKim Alvefur <zash@zash.se>
Wed, 19 Jul 2023 16:59:16 +0200
changeset 5613 e469642e6a6c
parent 5612 1893ae742f66
child 5614 67f7df9892bb
mod_muc_block_pm: Allow private messages to yourself No harm in it. Beagle apparently uses it for XEP-0333 in public channels
mod_muc_block_pm/mod_muc_block_pm.lua
--- a/mod_muc_block_pm/mod_muc_block_pm.lua	Wed Jul 19 13:05:47 2023 +0200
+++ b/mod_muc_block_pm/mod_muc_block_pm.lua	Wed Jul 19 16:59:16 2023 +0200
@@ -13,6 +13,10 @@
 		return -- messaging moderators is ok
 	end
 
+	if to_occupant.bare_jid == from_occupant.bare_jid then
+		return -- to yourself is okay, used by some clients to sync read state in public channels
+	end
+
 	room:route_to_occupant(from_occupant, st.error_reply(stanza, "cancel", "policy-violation", "Private messages are disabled", room.jid))
 	return false;
 end, 1);