25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +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>
* src/ejabberd_sm.erl: Added check for existence of incoming
subscription destination
* src/msgs/it.msg: Added italian translation (thanks to Luca
Brivio)

View File

@ -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,