Changeset

9518:a62fa766d8f3

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
author Kim Alvefur <zash@zash.se>
date Thu, 18 Oct 2018 19:07:01 +0200
parents 9517:b1c6ede17592
children 9519:e6e5ff64d1c2
files plugins/mod_vcard_legacy.lua
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua	Thu Oct 18 18:03:31 2018 +0100
+++ b/plugins/mod_vcard_legacy.lua	Thu Oct 18 19:07:01 2018 +0200
@@ -138,6 +138,11 @@
 	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 @@
 
 	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");