]> granicus.if.org Git - ejabberd/commitdiff
Fix IQ XML generation.
authorJerome Sautret <jerome.sautret@process-one.net>
Fri, 4 Jul 2014 13:21:40 +0000 (15:21 +0200)
committerJerome Sautret <jerome.sautret@process-one.net>
Fri, 4 Jul 2014 13:21:40 +0000 (15:21 +0200)
src/jlib.erl

index 7735d7dbce32ea84e8f92ca6f3a9bce6f19843d8..549c9b71bd6ceda9ec0c5c9e7548b901cd19e725 100644 (file)
@@ -451,15 +451,23 @@ iq_type_to_string(error) -> <<"error">>.
 ).
 
 iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) ->
+    Children = case Type of
+                  set ->
+                      [SubEl];
+                  get ->
+                      [SubEl];
+                  _ ->
+                      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/1 ::
@@ -800,7 +808,7 @@ base64_to_term(Base64) ->
 decode_base64(S) ->
     decode_base64_bin(S, <<>>).
 
-take_without_spaces(Bin, Count) -> 
+take_without_spaces(Bin, Count) ->
     take_without_spaces(Bin, Count, <<>>).
 
 take_without_spaces(Bin, 0, Acc) ->