Mercurial > prosody-hg
comparison 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 |
| parents | 9054b51e71a4 |
| children | 169772e3d4e0 |
comparison
equal
deleted
inserted
replaced
| 5477:50cbea68586f | 5479:81c599c7588b |
|---|---|
| 188 local node = publish.attr.node; | 188 local node = publish.attr.node; |
| 189 if not node then | 189 if not node then |
| 190 return origin.send(pubsub_error_reply(stanza, "nodeid-required")); | 190 return origin.send(pubsub_error_reply(stanza, "nodeid-required")); |
| 191 end | 191 end |
| 192 local item = publish:get_child("item"); | 192 local item = publish:get_child("item"); |
| 193 local id = (item and item.attr.id) or uuid_generate(); | 193 local id = (item and item.attr.id); |
| 194 if not id then | |
| 195 id = uuid_generate(); | |
| 196 item.attr.id = id; | |
| 197 end | |
| 194 local ok, ret = service:publish(node, stanza.attr.from, id, item); | 198 local ok, ret = service:publish(node, stanza.attr.from, id, item); |
| 195 local reply; | 199 local reply; |
| 196 if ok then | 200 if ok then |
| 197 reply = st.reply(stanza) | 201 reply = st.reply(stanza) |
| 198 :tag("pubsub", { xmlns = xmlns_pubsub }) | 202 :tag("pubsub", { xmlns = xmlns_pubsub }) |
