mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
External Component Connection Hooks
This commit is contained in:
parent
749033598d
commit
fca2f24231
@ -224,7 +224,9 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
|
|||||||
fun (H) ->
|
fun (H) ->
|
||||||
ejabberd_router:register_route(H, ?MYNAME),
|
ejabberd_router:register_route(H, ?MYNAME),
|
||||||
?INFO_MSG("Route registered for service ~p~n",
|
?INFO_MSG("Route registered for service ~p~n",
|
||||||
[H])
|
[H]),
|
||||||
|
ejabberd_hooks:run(component_connected,
|
||||||
|
[H])
|
||||||
end, dict:fetch_keys(StateData#state.host_opts)),
|
end, dict:fetch_keys(StateData#state.host_opts)),
|
||||||
{next_state, stream_established, StateData};
|
{next_state, stream_established, StateData};
|
||||||
_ ->
|
_ ->
|
||||||
@ -288,13 +290,19 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
end,
|
end,
|
||||||
{next_state, stream_established, StateData};
|
{next_state, stream_established, StateData};
|
||||||
stream_established({xmlstreamend, _Name}, StateData) ->
|
stream_established({xmlstreamend, _Name}, StateData) ->
|
||||||
|
ejabberd_hooks:run(component_disconnected,
|
||||||
|
[StateData#state.host]),
|
||||||
{stop, normal, StateData};
|
{stop, normal, StateData};
|
||||||
stream_established({xmlstreamerror, _}, StateData) ->
|
stream_established({xmlstreamerror, _}, StateData) ->
|
||||||
|
ejabberd_hooks:run(component_disconnected,
|
||||||
|
[StateData#state.host]),
|
||||||
send_text(StateData,
|
send_text(StateData,
|
||||||
<<(?INVALID_XML_ERR)/binary,
|
<<(?INVALID_XML_ERR)/binary,
|
||||||
(?STREAM_TRAILER)/binary>>),
|
(?STREAM_TRAILER)/binary>>),
|
||||||
{stop, normal, StateData};
|
{stop, normal, StateData};
|
||||||
stream_established(closed, StateData) ->
|
stream_established(closed, StateData) ->
|
||||||
|
ejabberd_hooks:run(component_disconnected,
|
||||||
|
[StateData#state.host]),
|
||||||
{stop, normal, StateData}.
|
{stop, normal, StateData}.
|
||||||
|
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user