mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Merge pull request #1201 from xmppjingle/master
External Component Connection Hooks
This commit is contained in:
commit
dd38bef8b1
@ -224,8 +224,10 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
|
||||
fun (H) ->
|
||||
ejabberd_router:register_route(H, ?MYNAME),
|
||||
?INFO_MSG("Route registered for service ~p~n",
|
||||
[H])
|
||||
end, dict:fetch_keys(StateData#state.host_opts)),
|
||||
[H]),
|
||||
ejabberd_hooks:run(component_connected,
|
||||
[H])
|
||||
end, dict:fetch_keys(StateData#state.host_opts)),
|
||||
{next_state, stream_established, StateData};
|
||||
_ ->
|
||||
send_text(StateData, ?INVALID_HANDSHAKE_ERR),
|
||||
@ -382,7 +384,9 @@ terminate(Reason, StateName, StateData) ->
|
||||
case StateName of
|
||||
stream_established ->
|
||||
lists:foreach(fun (H) ->
|
||||
ejabberd_router:unregister_route(H)
|
||||
ejabberd_router:unregister_route(H),
|
||||
ejabberd_hooks:run(component_disconnected,
|
||||
[StateData#state.host, Reason])
|
||||
end,
|
||||
dict:fetch_keys(StateData#state.host_opts));
|
||||
_ -> ok
|
||||
|
Loading…
Reference in New Issue
Block a user