diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index 3d1984ad0..d85d474fd 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -646,10 +646,14 @@ route_message(From, To, Packet) -> case ejabberd_auth:is_user_exists(exmpp_jid:prep_node_as_list(To), exmpp_jid:prep_domain_as_list(To)) of true -> - is_privacy_allow(From, To, Packet) andalso - ejabberd_hooks:run(offline_message_hook, - exmpp_jid:prep_domain(To), - [From, To, Packet]); + case is_privacy_allow(From, To, Packet) of + true -> + ejabberd_hooks:run(offline_message_hook, + exmpp_jid:prep_domain(To), + [From, To, Packet]); + false -> + ok + end; _ -> Err = exmpp_stanza:reply_with_error( Packet, 'service-unaivailable'),