Mercurial > prosody-modules
comparison mod_block_strangers/mod_block_strangers.lua @ 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 | 045d594a3707 |
children |
comparison
equal
deleted
inserted
replaced
3022:3996437ff64f | 3023:38365c1f1fe4 |
---|---|
18 function check_subscribed(event) | 18 function check_subscribed(event) |
19 local stanza = event.stanza; | 19 local stanza = event.stanza; |
20 local to_user, to_host, to_resource = jid_split(stanza.attr.to); | 20 local to_user, to_host, to_resource = jid_split(stanza.attr.to); |
21 local from_jid = jid_bare(stanza.attr.from); | 21 local from_jid = jid_bare(stanza.attr.from); |
22 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 | 22 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 |
23 -- Allow all messages from your own jid | |
24 if from_jid == to_user.."@"..to_host then | |
25 return nil; -- Pass through | |
26 end | |
23 if to_resource and stanza.attr.type == "groupchat" | 27 if to_resource and stanza.attr.type == "groupchat" |
24 or stanza.name == "iq" and (stanza.attr.type == "result" or stanza.attr.type == "error") then | 28 or stanza.name == "iq" and (stanza.attr.type == "result" or stanza.attr.type == "error") then |
25 return nil; -- Pass through | 29 return nil; -- Pass through |
26 end | 30 end |
27 if stanza.name == "iq" and ( stanza.attr.type == "get" or stanza.attr.type == "set" ) then | 31 if stanza.name == "iq" and ( stanza.attr.type == "get" or stanza.attr.type == "set" ) then |