# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1526995223 -3600
# Node ID 38365c1f1fe44e2193fda4295a99ad3cb67fcc72
# Parent  3996437ff64fc17150d044ef7307c9ea48b2d13f
mod_block_strangers: Allow stanza from self (fixes #966, thanks Sergey Popov)

diff -r 3996437ff64f -r 38365c1f1fe4 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