mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
* src/ejabberd_sm.erl: Added check for existence of incoming
subscription destination SVN Revision: 759
This commit is contained in:
parent
acdb78c28a
commit
2ae5d13ab8
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user