handle_send(El, Pkt, #{server_host := ServerHost} = State) ->
ejabberd_hooks:run_fold(s2s_out_handle_send, ServerHost, State, [El, Pkt]).
-handle_timeout(#{on_route := Action} = State) ->
+handle_timeout(#{on_route := Action, lang := Lang} = State) ->
case Action of
bounce -> stop(State);
- _ -> send(State, xmpp:serr_connection_timeout())
+ _ ->
+ Txt = <<"Idle connection">>,
+ send(State, xmpp:serr_connection_timeout(Txt, Lang))
end.
init([#{server := LServer, remote_server := RServer} = State, Opts]) ->
noreply(try Mod:handle_cdata(Data, State)
catch _:undef -> State
end);
-handle_info(timeout, #{mod := Mod} = State) ->
+handle_info(timeout, #{mod := Mod, lang := Lang} = State) ->
Disconnected = is_disconnected(State),
noreply(try Mod:handle_timeout(State)
catch _:undef when not Disconnected ->
- send_pkt(State, xmpp:serr_connection_timeout());
+ Txt = <<"Idle connection">>,
+ send_pkt(State, xmpp:serr_connection_timeout(Txt, Lang));
_:undef ->
stop(State)
end);
noreply(process_stream_end({stream, reset}, State));
handle_info({'$gen_event', closed}, State) ->
noreply(process_stream_end({socket, closed}, State));
-handle_info(timeout, #{mod := Mod} = State) ->
+handle_info(timeout, #{mod := Mod, lang := Lang} = State) ->
Disconnected = is_disconnected(State),
noreply(try Mod:handle_timeout(State)
catch _:undef when not Disconnected ->
- send_pkt(State, xmpp:serr_connection_timeout());
+ Txt = <<"Idle connection">>,
+ send_pkt(State, xmpp:serr_connection_timeout(Txt, Lang));
_:undef ->
stop(State)
end);