Changeset

3023:38365c1f1fe4

mod_block_strangers: Allow stanza from self (fixes #966, thanks Sergey Popov)
author Matthew Wild <mwild1@gmail.com>
date Tue, 22 May 2018 14:20:23 +0100
parents 3022:3996437ff64f
children 3024:f54c80404ad3
files mod_block_strangers/mod_block_strangers.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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