From 2ae5d13ab813febd3f077c673c661675df3af2ed Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Thu, 3 May 2007 05:15:12 +0000 Subject: [PATCH] * src/ejabberd_sm.erl: Added check for existence of incoming subscription destination SVN Revision: 759 --- ChangeLog | 3 +++ src/ejabberd_sm.erl | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 340cbb352..a1cae6617 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-05-03 Alexey Shchepin + * src/ejabberd_sm.erl: Added check for existence of incoming + subscription destination + * src/msgs/it.msg: Added italian translation (thanks to Luca Brivio) diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index 4b67ef719..7fa24793b 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -15,6 +15,7 @@ -export([start_link/0, route/3, open_session/4, close_session/4, + check_in_subscription/6, bounce_offline_message/3, disconnect_removed_user/2, get_user_resources/2, @@ -79,6 +80,14 @@ close_session(SID, User, Server, Resource) -> ejabberd_hooks:run(sm_remove_connection_hook, JID#jid.lserver, [SID, JID]). +check_in_subscription(Acc, User, Server, JID, Type, Reason) -> + case ejabberd_auth:is_user_exists(User, Server) of + true -> + Acc; + false -> + {stop, false} + end. + bounce_offline_message(From, To, Packet) -> Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE), ejabberd_router:route(To, From, Err), @@ -170,6 +179,8 @@ init([]) -> ets:new(sm_iqtable, [named_table]), lists:foreach( fun(Host) -> + ejabberd_hooks:add(roster_in_subscription, Host, + ejabberd_sm, check_in_subscription, 20), ejabberd_hooks:add(offline_message_hook, Host, ejabberd_sm, bounce_offline_message, 100), ejabberd_hooks:add(remove_user, Host, -- 2.40.0