]> granicus.if.org Git - ejabberd/commitdiff
Allow node creation without configure item
authorChristophe Romain <christophe.romain@process-one.net>
Wed, 4 Mar 2009 01:10:44 +0000 (01:10 +0000)
committerChristophe Romain <christophe.romain@process-one.net>
Wed, 4 Mar 2009 01:10:44 +0000 (01:10 +0000)
SVN Revision: 1962

ChangeLog
src/mod_pubsub/mod_pubsub.erl

index 3fab5bf73ff2659370a48034c58f5de55a54483a..44fe628cef94b6aaa81c47e89f6e6d9afeef99bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/mod_pubsub/mod_pubsub.erl: Add roster subscriptions handling
index d9096fb073badd21790d0696091f6294f8b13bb8..badd56f7d16464bf9e099761133fc8f50b3b4453 100644 (file)
@@ -920,30 +920,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