Changeset

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
parents 5477:50cbea68586f
children 5480:415e520e4a4c 5481:169772e3d4e0
files plugins/mod_pubsub.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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