From 644873dae9a5c91a1e40c3e09703bd01a151217a Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Wed, 27 Jun 2018 15:02:03 +0300 Subject: [PATCH] Don't check packets sent to self --- src/mod_block_strangers.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod_block_strangers.erl b/src/mod_block_strangers.erl index 6f25b6417..fbbef1899 100644 --- a/src/mod_block_strangers.erl +++ b/src/mod_block_strangers.erl @@ -190,6 +190,8 @@ maybe_adjust_from(#message{} = Msg) -> need_check(Pkt) -> To = xmpp:get_to(Pkt), From = xmpp:get_from(Pkt), + IsSelf = To#jid.luser == From#jid.luser andalso + To#jid.lserver == From#jid.lserver, LServer = To#jid.lserver, IsEmpty = case Pkt of #message{body = [], subject = []} -> @@ -199,7 +201,8 @@ need_check(Pkt) -> end, AllowLocalUsers = gen_mod:get_module_opt(LServer, ?MODULE, allow_local_users), Access = gen_mod:get_module_opt(LServer, ?MODULE, access), - not (IsEmpty orelse acl:match_rule(LServer, Access, From) == allow + not (IsSelf orelse IsEmpty + orelse acl:match_rule(LServer, Access, From) == allow orelse ((AllowLocalUsers orelse From#jid.luser == <<"">>) andalso ejabberd_router:is_my_host(From#jid.lserver))).