diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-18 19:07:01 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-18 19:07:01 +0200 |
commit | 8022b2de599d118ef760b2c78f2c37950f01cc25 (patch) | |
tree | 67c7aeb238eab78fcba0960d4f54c63eaba6464d /plugins/mod_vcard_legacy.lua | |
parent | d18c2d6c65410e356057bdcd970bccc7ceffb8e0 (diff) | |
download | prosody-8022b2de599d118ef760b2c78f2c37950f01cc25.tar.gz prosody-8022b2de599d118ef760b2c78f2c37950f01cc25.zip |
mod_vcard_legacy: Create nodes with open access (fixes #1221)
Less drastic change from mod_vcard where everything is always public.
This allows users to configure nodes without needing to for the old
behaviour.
Thanks to 038446c50630 users may still override this.
Due to #1222 this may still not apply if the node has already been
created by an automatic subscription
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index b822e56c..8b9c86f2 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -138,6 +138,11 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event) return true; end); +local node_defaults = { + access_model = "open"; + _defaults_only = true; +}; + module:hook("iq-set/self/vcard-temp:vCard", function (event) local origin, stanza = event.origin, event.stanza; local pep_service = mod_pep.get_pep_service(origin.username); @@ -149,8 +154,13 @@ module:hook("iq-set/self/vcard-temp:vCard", function (event) if pep_service:purge("urn:xmpp:avatar:metadata", origin.full_jid) then pep_service:purge("urn:xmpp:avatar:data", origin.full_jid); + else + pep_service:create("urn:xmpp:avatar:metadata", origin.full_jid, node_defaults); + pep_service:create("urn:xmpp:avatar:data", origin.full_jid, node_defaults); end + pep_service:create("urn:xmpp:vcard4", origin.full_jid, node_defaults); + vcard4:tag("fn"):text_tag("text", vcard_temp:get_child_text("FN")):up(); local N = vcard_temp:get_child("N"); |