diff options
Diffstat (limited to 'src/jlib.erl')
-rw-r--r-- | src/jlib.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/jlib.erl b/src/jlib.erl index 4bc9b0055..3384e670e 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -371,15 +371,20 @@ iq_type_to_string(error) -> <<"error">>. -spec iq_to_xml(IQ :: iq()) -> xmlel(). iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) -> + Children = + if + is_list(SubEl) -> SubEl; + true -> [SubEl] + end, if ID /= <<"">> -> #xmlel{name = <<"iq">>, attrs = [{<<"id">>, ID}, {<<"type">>, iq_type_to_string(Type)}], - children = SubEl}; + children = Children}; true -> #xmlel{name = <<"iq">>, attrs = [{<<"type">>, iq_type_to_string(Type)}], - children = SubEl} + children = Children} end. -spec parse_xdata_submit(El :: xmlel()) -> |