Software /
code /
prosody
Diff
plugins/mod_pubsub.lua @ 5479:81c599c7588b
mod_pubsub: Add id to stored item when auto-generated. Fixes #335
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 17 Apr 2013 14:12:47 +0100 |
parent | 5445:9054b51e71a4 |
child | 5481:169772e3d4e0 |
line wrap: on
line diff
--- a/plugins/mod_pubsub.lua Mon Apr 15 21:25:59 2013 +0100 +++ b/plugins/mod_pubsub.lua Wed Apr 17 14:12:47 2013 +0100 @@ -190,7 +190,11 @@ 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