aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2009-03-04 01:12:10 +0000
committerChristophe Romain <christophe.romain@process-one.net>2009-03-04 01:12:10 +0000
commitb3c39d120f8cf8eab1fcb34a75d9bd7342c9fbaf (patch)
treed94528821bf4ef7ce746333b8cc00f3da2b758df /src
parentupdate pubsub version (diff)
Allow node creation without configure item
SVN Revision: 1963
Diffstat (limited to 'src')
-rw-r--r--src/mod_pubsub/mod_pubsub.erl43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl
index 9def48bd6..97b3aea8b 100644
--- a/src/mod_pubsub/mod_pubsub.erl
+++ b/src/mod_pubsub/mod_pubsub.erl
@@ -925,30 +925,25 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, _Lang, Access, Plugins) ->
end,
case {IQType, Name} of
{set, "create"} ->
- case Configuration of
- [{xmlelement, "configure", _, Config}] ->
- %% Get the type of the node
- Type = case xml:get_attr_s("type", Attrs) of
- [] -> hd(Plugins);
- T -> T
- end,
- %% we use Plugins list matching because we do not want to allocate
- %% atoms for non existing type, this prevent atom allocation overflow
- case lists:member(Type, Plugins) of
- false ->
- {error, extended_error(
- ?ERR_FEATURE_NOT_IMPLEMENTED,
- unsupported, "create-nodes")};
- true ->
- create_node(Host, ServerHost, Node, From,
- Type, Access, Config)
- end;
- _ ->
- %% 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}
+ Config = case Configuration of
+ [{xmlelement, "configure", _, C}] -> C;
+ _ -> []
+ end,
+ %% Get the type of the node
+ Type = case xml:get_attr_s("type", Attrs) of
+ [] -> hd(Plugins);
+ T -> T
+ end,
+ %% we use Plugins list matching because we do not want to allocate
+ %% atoms for non existing type, this prevent atom allocation overflow
+ case lists:member(Type, Plugins) of
+ false ->
+ {error, extended_error(
+ ?ERR_FEATURE_NOT_IMPLEMENTED,
+ unsupported, "create-nodes")};
+ true ->
+ create_node(Host, ServerHost, Node, From,
+ Type, Access, Config)
end;
{set, "publish"} ->
case xml:remove_cdata(Els) of