From 3ac1ca54c7d0ba763cb2950e139a789feaaa1e44 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 17 Apr 2013 14:12:47 +0100 Subject: mod_pubsub: Add id to stored item when auto-generated. Fixes #335 --- plugins/mod_pubsub.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') 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 -- cgit v1.2.3