summaryrefslogtreecommitdiff
path: root/src/jlib.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2016-09-07 14:34:31 +0200
committerChristophe Romain <christophe.romain@process-one.net>2016-09-07 14:34:31 +0200
commitaf0a493c663ea591305b0562810f142803a03c32 (patch)
treed883bf5b145ad4a888c5ee35c96404d5d81b8de9 /src/jlib.erl
parentCreate room on configuration request as per XEP-0045, 10.1.3 (diff)
Merge pull request #1253 from Amuhar/xep0356
Diffstat (limited to 'src/jlib.erl')
-rw-r--r--src/jlib.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/jlib.erl b/src/jlib.erl
index 4bc9b005..3384e670 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()) ->