From ad1aec6cd1d142c6a522b67c71739ce6b753aade Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Wed, 3 Feb 2010 12:10:08 +0000 Subject: [PATCH] avoid resending stanzas on terminate (EJAB-1180) SVN Revision: 2957 --- src/web/ejabberd_http_poll.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/web/ejabberd_http_poll.erl b/src/web/ejabberd_http_poll.erl index 1aac88714..c222050e6 100644 --- a/src/web/ejabberd_http_poll.erl +++ b/src/web/ejabberd_http_poll.erl @@ -434,11 +434,16 @@ resend_messages(Messages) -> %% This function is used to resend messages that have been polled but not %% delivered. resend_message(Packet) -> - [ParsedPacket] = exmpp_xml:parse_document(Packet, ?PARSER_OPTIONS), - 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). + [#xmlel{name = Name} = ParsedPacket] = + exmpp_xml:parse_document(Packet, ?PARSER_OPTIONS), + 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.