Diff

mod_profile/mod_profile.lua @ 3251:60821653c5a9

mod_profile: Only retrieve the last avatar hash from PEP
author Kim Alvefur <zash@zash.se>
date Tue, 21 Aug 2018 11:00:30 +0200
parent 3246:2a54b331f011
child 3252:eec70a863d16
line wrap: on
line diff
--- a/mod_profile/mod_profile.lua	Mon Aug 20 23:20:01 2018 +0200
+++ b/mod_profile/mod_profile.lua	Tue Aug 21 11:00:30 2018 +0200
@@ -247,9 +247,9 @@
 
 	stanza:remove_children("x", "vcard-temp:x:update");
 	local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" });
-	local ok, avatar_hash = pep:get_items("urn:xmpp:avatar:metadata", true);
-	if ok and avatar_hash[1] then
-		x_update:text_tag("photo", avatar_hash[1]);
+	local ok, avatar_hash = pep:get_last_item("urn:xmpp:avatar:metadata", true);
+	if ok and avatar_hash then
+		x_update:text_tag("photo", avatar_hash);
 	end
 	stanza:add_direct_child(x_update);
 end