From a25609f66bb8a0f2f5f4746b0ea7bb9a2e3d63bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Tue, 1 Jul 2008 14:19:36 +0000 Subject: [PATCH] Accept new #xmlel in functions that create #iq. A warning is printed when these functions are called with an old #xmlelement. SVN Revision: 1403 --- ChangeLog | 4 ++++ src/jlib.erl | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4f760626..92f2b00cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,10 @@ * src/ejabberd_local.erl: Convert to exmpp. + * src/jlib.erl: Accept new #xmlel in functions that create #iq. A + warning is printed when these functions are called with an old + #xmlelement. + 2008-06-30 Jean-Sébastien Pédron * src/Makefile.in: Remove the -I flag for exmpp includes; the diff --git a/src/jlib.erl b/src/jlib.erl index 4a0fbcbfa..b926c15fb 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -360,7 +360,17 @@ iq_query_info(El) -> iq_query_or_response_info(El) -> iq_info_internal(El, any). -iq_info_internal({xmlelement, Name, Attrs, Els}, Filter) when Name == "iq" -> +iq_info_internal({xmlel, NS, _, _, _, _} = El, Filter) -> + ElOld = exmpp_xml:xmlel_to_xmlelement(El, [NS], + [{'http://etherx.jabber.org/streams', "stream"}]), + iq_info_internal2(ElOld, Filter); +iq_info_internal(El, Filter) -> + catch throw(for_stacktrace), + io:format("~nJLIB: old #xmlelement:~n~p~n~p~n~n", + [El, erlang:get_stacktrace()]), + iq_info_internal2(El, Filter). + +iq_info_internal2({xmlelement, Name, Attrs, Els}, Filter) when Name == "iq" -> %% Filter is either request or any. If it is request, any replies %% are converted to the atom reply. ID = xml:get_attr_s("id", Attrs), @@ -413,7 +423,7 @@ iq_info_internal({xmlelement, Name, Attrs, Els}, Filter) when Name == "iq" -> Class == reply, Filter /= any -> reply end; -iq_info_internal(_, _) -> +iq_info_internal2(_, _) -> not_iq. is_iq_request_type(set) -> true;