diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-17 14:12:47 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-17 14:12:47 +0100 |
commit | 3ac1ca54c7d0ba763cb2950e139a789feaaa1e44 (patch) | |
tree | 0c90ca4d14ad5a045fe03a72052e3d1f8aa28829 /plugins/mod_pubsub.lua | |
parent | 427b82db0fd0d82101013628e0bc4158eeb72c06 (diff) | |
download | prosody-3ac1ca54c7d0ba763cb2950e139a789feaaa1e44.tar.gz prosody-3ac1ca54c7d0ba763cb2950e139a789feaaa1e44.zip |
mod_pubsub: Add id to stored item when auto-generated. Fixes #335
Diffstat (limited to 'plugins/mod_pubsub.lua')
-rw-r--r-- | plugins/mod_pubsub.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua index 7bd33102..4d3911bb 100644 --- a/plugins/mod_pubsub.lua +++ b/plugins/mod_pubsub.lua @@ -190,7 +190,11 @@ 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(); + item.attr.id = id; + end local ok, ret = service:publish(node, stanza.attr.from, id, item); local reply; if ok then |