25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

avoid resending <stream:error> stanzas on terminate (EJAB-1180)

SVN Revision: 2955
This commit is contained in:
Evgeniy Khramtsov 2010-02-03 11:25:03 +00:00
parent 35bcadde7a
commit 9d84caebdb

View File

@ -426,11 +426,16 @@ resend_messages(Messages) ->
%% This function is used to resend messages that have been polled but not
%% delivered.
resend_message(Packet) ->
ParsedPacket = xml_stream:parse_element(Packet),
From = get_jid("from", ParsedPacket),
To = get_jid("to", ParsedPacket),
?DEBUG("Resend ~p ~p ~p~n",[From,To, ParsedPacket]),
ejabberd_router:route(From, To, ParsedPacket).
{xmlelement, Name, _, _} = ParsedPacket = xml_stream:parse_element(Packet),
%% Avoid sending <stream:error>
if Name == "iq"; Name == "message"; Name == "presence" ->
From = get_jid("from", ParsedPacket),
To = get_jid("to", ParsedPacket),
?DEBUG("Resend ~p ~p ~p~n",[From,To, ParsedPacket]),
ejabberd_router:route(From, To, ParsedPacket);
true ->
ok
end.
%% Type can be "from" or "to"
%% Parsed packet is a parsed Jabber packet.