X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_pubsub.lua;h=22969ab5f067d9fee54364c8ffc933d9fcf6bb99;hb=bca9d41c435fcce947eb9ee166efae96becbac5f;hp=8f078f54fbd075fe06945d190b1731b56523ebf6;hpb=50cd68c08e19d94f4c2dcbcea6a1ca45cd1f0a02;p=prosody.git diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua index 8f078f54..22969ab5 100644 --- a/plugins/mod_pubsub.lua +++ b/plugins/mod_pubsub.lua @@ -22,7 +22,9 @@ function handle_pubsub_iq(event) local origin, stanza = event.origin, event.stanza; local pubsub = stanza.tags[1]; local action = pubsub.tags[1]; - if not action then return; end + if not action then + return origin.send(st.error_reply(stanza, "cancel", "bad-request")); + end local handler = handlers[stanza.attr.type.."_"..action.name]; if handler then handler(origin, stanza, action); @@ -188,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