Diff

plugins/mod_vcard_legacy.lua @ 9269:6097dc7d4847

mod_vcard_legacy: Return error in case saving avatar fails
author Kim Alvefur <zash@zash.se>
date Thu, 06 Sep 2018 23:51:03 +0200
parent 9268:628b99811301
child 9270:b024fae6919e
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua	Thu Sep 06 23:33:44 2018 +0200
+++ b/plugins/mod_vcard_legacy.lua	Thu Sep 06 23:51:03 2018 +0200
@@ -240,8 +240,13 @@
 					:tag("data", { xmlns="urn:xmpp:avatar:data" })
 						:text(avatar_payload);
 
-				if pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data) then
-					pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta);
+				local ok, err = pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data)
+				if ok then
+					ok, err = pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta);
+				end
+				if not ok then
+					handle_error(origin, stanza, err);
+					return true;
 				end
 			end
 		end