Software /
code /
prosody
Comparison
plugins/mod_vcard_legacy.lua @ 9520:d6964d16455c
mod_vcard_legacy: Pass node defaults to publish instead of create
The create calls were introduced in 62fa766d8f3 but work on this started
a while before 038446c50630 allowed passing the _defaults_only flag to
publish.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 20 Oct 2018 14:29:20 +0200 |
parent | 9518:a62fa766d8f3 |
child | 9672:e71484c210fb |
comparison
equal
deleted
inserted
replaced
9519:e6e5ff64d1c2 | 9520:d6964d16455c |
---|---|
152 local vcard4 = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = "current" }) | 152 local vcard4 = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = "current" }) |
153 :tag("vcard", { xmlns = 'urn:ietf:params:xml:ns:vcard-4.0' }); | 153 :tag("vcard", { xmlns = 'urn:ietf:params:xml:ns:vcard-4.0' }); |
154 | 154 |
155 if pep_service:purge("urn:xmpp:avatar:metadata", origin.full_jid) then | 155 if pep_service:purge("urn:xmpp:avatar:metadata", origin.full_jid) then |
156 pep_service:purge("urn:xmpp:avatar:data", origin.full_jid); | 156 pep_service:purge("urn:xmpp:avatar:data", origin.full_jid); |
157 else | 157 end |
158 pep_service:create("urn:xmpp:avatar:metadata", origin.full_jid, node_defaults); | |
159 pep_service:create("urn:xmpp:avatar:data", origin.full_jid, node_defaults); | |
160 end | |
161 | |
162 pep_service:create("urn:xmpp:vcard4", origin.full_jid, node_defaults); | |
163 | 158 |
164 vcard4:tag("fn"):text_tag("text", vcard_temp:get_child_text("FN")):up(); | 159 vcard4:tag("fn"):text_tag("text", vcard_temp:get_child_text("FN")):up(); |
165 | 160 |
166 local N = vcard_temp:get_child("N"); | 161 local N = vcard_temp:get_child("N"); |
167 | 162 |
251 | 246 |
252 local avatar_data = st.stanza("item", { id = avatar_hash, xmlns = "http://jabber.org/protocol/pubsub" }) | 247 local avatar_data = st.stanza("item", { id = avatar_hash, xmlns = "http://jabber.org/protocol/pubsub" }) |
253 :tag("data", { xmlns="urn:xmpp:avatar:data" }) | 248 :tag("data", { xmlns="urn:xmpp:avatar:data" }) |
254 :text(avatar_payload); | 249 :text(avatar_payload); |
255 | 250 |
256 local ok, err = pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data) | 251 local ok, err = pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data, node_defaults) |
257 if ok then | 252 if ok then |
258 ok, err = pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta); | 253 ok, err = pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta, node_defaults); |
259 end | 254 end |
260 if not ok then | 255 if not ok then |
261 handle_error(origin, stanza, err); | 256 handle_error(origin, stanza, err); |
262 return true; | 257 return true; |
263 end | 258 end |
264 end | 259 end |
265 end | 260 end |
266 end | 261 end |
267 | 262 |
268 local ok, err = pep_service:publish("urn:xmpp:vcard4", origin.full_jid, "current", vcard4); | 263 local ok, err = pep_service:publish("urn:xmpp:vcard4", origin.full_jid, "current", vcard4, node_defaults); |
269 if ok then | 264 if ok then |
270 origin.send(st.reply(stanza)); | 265 origin.send(st.reply(stanza)); |
271 else | 266 else |
272 handle_error(origin, stanza, err); | 267 handle_error(origin, stanza, err); |
273 end | 268 end |