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

Allow node creation without configure item

SVN Revision: 1964
This commit is contained in:
Christophe Romain 2009-03-04 01:14:13 +00:00
parent 592c98fd7a
commit ab2dc5877f

View File

@ -929,30 +929,25 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, _Lang, Access, Plugins) ->
end, end,
case {IQType, Name} of case {IQType, Name} of
{set, 'create'} -> {set, 'create'} ->
case Configuration of Config = case Configuration of
[#xmlel{name = 'configure', children = Config}] -> [#xmlel{name = 'configure', children = C}] -> C;
%% Get the type of the node _ -> []
Type = case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', "") of end,
[] -> hd(Plugins); %% Get the type of the node
T -> T Type = case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', "") of
end, [] -> hd(Plugins);
%% we use Plugins list matching because we do not want to allocate T -> T
%% atoms for non existing type, this prevent atom allocation overflow end,
case lists:member(Type, Plugins) of %% we use Plugins list matching because we do not want to allocate
false -> %% atoms for non existing type, this prevent atom allocation overflow
{error, extended_error( case lists:member(Type, Plugins) of
'feature-not-implemented', false ->
unsupported, "create-nodes")}; {error, extended_error(
true -> 'feature-not-implemented',
create_node(Host, ServerHost, Node, From, unsupported, "create-nodes")};
Type, Access, Config) true ->
end; create_node(Host, ServerHost, Node, From,
_ -> Type, Access, Config)
%% this breaks backward compatibility!
%% can not create node without <configure/>
%% but this is the new spec anyway
?INFO_MSG("Node ~p ; invalid configuration: ~p", [Node, Configuration]),
{error, 'bad-request'}
end; end;
{set, 'publish'} -> {set, 'publish'} ->
case exmpp_xml:remove_cdata_from_list(Els) of case exmpp_xml:remove_cdata_from_list(Els) of