From d4ebb070dfe68782852f6d32f6cc00e558a62785 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Sat, 1 Sep 2018 18:10:33 +0200
Subject: mod_vcard_legacy: Clear avatars on setting a vcard-temp

Otherwise it is not possible to remove avatars
---
 plugins/mod_vcard_legacy.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 5c2625e4..51d84dc3 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -134,6 +134,10 @@ module:hook("iq-set/self/vcard-temp:vCard", function (event)
 	local vcard4 = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = "current" })
 		:tag("vcard", { xmlns = 'urn:ietf:params:xml:ns:vcard-4.0' });
 
+	if pep_service:purge("urn:xmpp:avatar:metadata", origin.full_jid) then
+		pep_service:publish("urn:xmpp:avatar:data", origin.full_jid);
+	end
+
 	vcard4:tag("fn"):text_tag("text", vcard_temp:get_child_text("FN")):up();
 
 	local N = vcard_temp:get_child("N");
-- 
cgit v1.2.3