Merge s2s branch
[prosody.git] / plugins / mod_pubsub.lua
index 7bd331029a59ac37b095efe4ee189d9f9b7b92f2..22969ab5f067d9fee54364c8ffc933d9fcf6bb99 100644 (file)
@@ -190,7 +190,13 @@ function handlers.set_publish(origin, stanza, publish)
                return origin.send(pubsub_error_reply(stanza, "nodeid-required"));
        end
        local item = publish:get_child("item");
-       local id = (item and item.attr.id) or uuid_generate();
+       local id = (item and item.attr.id);
+       if not id then
+               id = uuid_generate();
+               if item then
+                       item.attr.id = id;
+               end
+       end
        local ok, ret = service:publish(node, stanza.attr.from, id, item);
        local reply;
        if ok then