Mercurial > prosody-hg
comparison plugins/mod_pubsub.lua @ 5481:169772e3d4e0
mod_pubsub: Only assign id to item element if there is one
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 17 Apr 2013 14:32:26 +0100 |
| parents | 81c599c7588b |
| children | c45997aebaa2 |
comparison
equal
deleted
inserted
replaced
| 5479:81c599c7588b | 5481:169772e3d4e0 |
|---|---|
| 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); | 193 local id = (item and item.attr.id); |
| 194 if not id then | 194 if not id then |
| 195 id = uuid_generate(); | 195 id = uuid_generate(); |
| 196 item.attr.id = id; | 196 if item then |
| 197 item.attr.id = id; | |
| 198 end | |
| 197 end | 199 end |
| 198 local ok, ret = service:publish(node, stanza.attr.from, id, item); | 200 local ok, ret = service:publish(node, stanza.attr.from, id, item); |
| 199 local reply; | 201 local reply; |
| 200 if ok then | 202 if ok then |
| 201 reply = st.reply(stanza) | 203 reply = st.reply(stanza) |
