24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-08 21:43:07 +02:00

Fix IQ XML generation.

This commit is contained in:
Jerome Sautret 2014-07-04 15:21:40 +02:00
parent 9265720f92
commit 26a4d91297

View File

@ -451,15 +451,23 @@ iq_type_to_string(error) -> <<"error">>.
). ).
iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) -> iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) ->
Children = case Type of
set ->
[SubEl];
get ->
[SubEl];
_ ->
SubEl
end,
if ID /= <<"">> -> if ID /= <<"">> ->
#xmlel{name = <<"iq">>, #xmlel{name = <<"iq">>,
attrs = attrs =
[{<<"id">>, ID}, {<<"type">>, iq_type_to_string(Type)}], [{<<"id">>, ID}, {<<"type">>, iq_type_to_string(Type)}],
children = SubEl}; children = Children};
true -> true ->
#xmlel{name = <<"iq">>, #xmlel{name = <<"iq">>,
attrs = [{<<"type">>, iq_type_to_string(Type)}], attrs = [{<<"type">>, iq_type_to_string(Type)}],
children = SubEl} children = Children}
end. end.
-spec(parse_xdata_submit/1 :: -spec(parse_xdata_submit/1 ::
@ -800,7 +808,7 @@ base64_to_term(Base64) ->
decode_base64(S) -> decode_base64(S) ->
decode_base64_bin(S, <<>>). decode_base64_bin(S, <<>>).
take_without_spaces(Bin, Count) -> take_without_spaces(Bin, Count) ->
take_without_spaces(Bin, Count, <<>>). take_without_spaces(Bin, Count, <<>>).
take_without_spaces(Bin, 0, Acc) -> take_without_spaces(Bin, 0, Acc) ->