mod_block_strangers: Allow stanza from self (fixes #966, thanks Sergey Popov)
authorMatthew Wild <mwild1@gmail.com>
Tue, 22 May 2018 14:20:23 +0100
changeset 3027 38365c1f1fe4
parent 3026 3996437ff64f
child 3028 f54c80404ad3
mod_block_strangers: Allow stanza from self (fixes #966, thanks Sergey Popov)
mod_block_strangers/mod_block_strangers.lua
--- a/mod_block_strangers/mod_block_strangers.lua	Sun May 20 17:19:46 2018 +0200
+++ b/mod_block_strangers/mod_block_strangers.lua	Tue May 22 14:20:23 2018 +0100
@@ -20,6 +20,10 @@
 	local to_user, to_host, to_resource = jid_split(stanza.attr.to);
 	local from_jid = jid_bare(stanza.attr.from);
 	if to_user and not has_directed_presence(stanza.attr.to, from_jid) and not is_contact_subscribed(to_user, to_host, from_jid) then
+		-- Allow all messages from your own jid
+		if from_jid == to_user.."@"..to_host then
+			return nil; -- Pass through
+		end
 		if to_resource and stanza.attr.type == "groupchat"
 		or stanza.name == "iq" and (stanza.attr.type == "result" or stanza.attr.type == "error") then
 			return nil; -- Pass through