Allow node creation without configure item

SVN Revision: 1962
This commit is contained in:
Christophe Romain 2009-03-04 01:10:44 +00:00
parent abbfa96fc4
commit e4db030f4e
2 changed files with 24 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2009-03-04 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: Allow node creation without configure
item
2009-03-03 Christophe Romain <christophe.romain@process-one.net> 2009-03-03 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: Add roster subscriptions handling * src/mod_pubsub/mod_pubsub.erl: Add roster subscriptions handling

View File

@ -920,30 +920,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
[{xmlelement, "configure", _, Config}] -> [{xmlelement, "configure", _, C}] -> C;
%% Get the type of the node _ -> []
Type = case xml:get_attr_s("type", Attrs) of end,
[] -> hd(Plugins); %% Get the type of the node
T -> T Type = case xml:get_attr_s("type", Attrs) 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
?ERR_FEATURE_NOT_IMPLEMENTED, false ->
unsupported, "create-nodes")}; {error, extended_error(
true -> ?ERR_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, ?ERR_BAD_REQUEST}
end; end;
{set, "publish"} -> {set, "publish"} ->
case xml:remove_cdata(Els) of case xml:remove_cdata(Els) of