25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

improve configure parsing in iq_pubsub (sync with ejabberd 2.1.0)

SVN Revision: 2605
This commit is contained in:
Christophe Romain 2009-09-20 08:14:24 +00:00
parent 36676f0719
commit 6bdf4aa960

View File

@ -1185,20 +1185,15 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) ->
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(ServerHost)).
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
WithoutCdata = exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children),
Configuration = lists:filter(fun(#xmlel{name = 'configure'}) -> true;
(_) -> false
end, WithoutCdata),
Action = WithoutCdata -- Configuration,
case Action of
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of
[#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] ->
Node = case Host of
{_, _, _} -> exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false);
_ -> string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false))
end,
case {IQType, Name} of
{set, 'create'} ->
Config = case Configuration of
Config = case Rest of
[#xmlel{name = 'configure', children = C}] -> C;
_ -> []
end,