25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-31 15:21:38 +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, all, plugins(ServerHost)).
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) -> iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
WithoutCdata = exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children), case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of
Configuration = lists:filter(fun(#xmlel{name = 'configure'}) -> true; [#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] ->
(_) -> false
end, WithoutCdata),
Action = WithoutCdata -- Configuration,
case Action of
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
Node = case Host of Node = case Host of
{_, _, _} -> exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false); {_, _, _} -> 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)) _ -> string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false))
end, end,
case {IQType, Name} of case {IQType, Name} of
{set, 'create'} -> {set, 'create'} ->
Config = case Configuration of Config = case Rest of
[#xmlel{name = 'configure', children = C}] -> C; [#xmlel{name = 'configure', children = C}] -> C;
_ -> [] _ -> []
end, end,