25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

* src/ejabberd_sm.erl: Added check for existence of incoming

subscription destination

SVN Revision: 759
This commit is contained in:
Alexey Shchepin 2007-05-03 05:15:12 +00:00
parent acdb78c28a
commit 2ae5d13ab8
2 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2007-05-03 Alexey Shchepin <alexey@sevcom.net> 2007-05-03 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_sm.erl: Added check for existence of incoming
subscription destination
* src/msgs/it.msg: Added italian translation (thanks to Luca * src/msgs/it.msg: Added italian translation (thanks to Luca
Brivio) Brivio)

View File

@ -15,6 +15,7 @@
-export([start_link/0, -export([start_link/0,
route/3, route/3,
open_session/4, close_session/4, open_session/4, close_session/4,
check_in_subscription/6,
bounce_offline_message/3, bounce_offline_message/3,
disconnect_removed_user/2, disconnect_removed_user/2,
get_user_resources/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, ejabberd_hooks:run(sm_remove_connection_hook, JID#jid.lserver,
[SID, JID]). [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) -> bounce_offline_message(From, To, Packet) ->
Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE), Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err), ejabberd_router:route(To, From, Err),
@ -170,6 +179,8 @@ init([]) ->
ets:new(sm_iqtable, [named_table]), ets:new(sm_iqtable, [named_table]),
lists:foreach( lists:foreach(
fun(Host) -> fun(Host) ->
ejabberd_hooks:add(roster_in_subscription, Host,
ejabberd_sm, check_in_subscription, 20),
ejabberd_hooks:add(offline_message_hook, Host, ejabberd_hooks:add(offline_message_hook, Host,
ejabberd_sm, bounce_offline_message, 100), ejabberd_sm, bounce_offline_message, 100),
ejabberd_hooks:add(remove_user, Host, ejabberd_hooks:add(remove_user, Host,