From d9e345a4d85b7e3b17a476d1b00b56ed3c8ddfde Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Tue, 2 Feb 2010 12:20:19 +0000 Subject: [PATCH] iq_query_info/1 now returns 'invalid' if XMLNS is invalid SVN Revision: 2953 --- src/jlib.erl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/jlib.erl b/src/jlib.erl index f0dffe08a..5df54d6dd 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -382,7 +382,7 @@ iq_info_internal({xmlelement, Name, Attrs, Els}, Filter) when Name == "iq" -> "result" -> {result, reply}; "error" -> {error, reply}; _ -> {invalid, invalid} - end, + end, if Type1 == invalid -> invalid; @@ -404,22 +404,26 @@ iq_info_internal({xmlelement, Name, Attrs, Els}, Filter) when Name == "iq" -> <- FilteredEls, SubName /= "error"], {case NonErrorEls of - [NonErrorEl] -> xml:get_tag_attr_s("xmlns", NonErrorEl); - _ -> invalid + [NonErrorEl] -> + xml:get_tag_attr_s("xmlns", NonErrorEl); + _ -> + invalid end, FilteredEls}; _ -> - {invalid, invalid} + {invalid, []} end, if XMLNS == "", Class == request -> invalid; + XMLNS == invalid -> + invalid; true -> - #iq{id = ID, - type = Type1, - xmlns = XMLNS, - lang = Lang, + #iq{id = ID, + type = Type1, + xmlns = XMLNS, + lang = Lang, sub_el = SubEl} - end; + end; Class == reply, Filter /= any -> reply end;