aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_vcard_legacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-01-11 09:20:48 +0100
committerKim Alvefur <zash@zash.se>2019-01-11 09:20:48 +0100
commit2db6a382cddf53ea0ef4a85beb6458eab4b4001e (patch)
tree2171468e26dd5e3a4449710842c35beaafe3e98d /plugins/mod_vcard_legacy.lua
parent5051a24481920248fc1a10693e8f0fbf13498dcf (diff)
downloadprosody-2db6a382cddf53ea0ef4a85beb6458eab4b4001e.tar.gz
prosody-2db6a382cddf53ea0ef4a85beb6458eab4b4001e.zip
mod_vcard_legacy: Adapt node defaults to number of avatars
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r--plugins/mod_vcard_legacy.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 5c40b7dd..80ce9e61 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -254,10 +254,18 @@ function save_to_pep(pep_service, actor, vcard4, avatars)
pep_service:purge("urn:xmpp:avatar:data", actor);
end
+ local avatar_defaults = node_defaults;
+ if #avatars > 1 then
+ avatar_defaults = {};
+ for k,v in pairs(node_defaults) do
+ avatar_defaults[k] = v;
+ end
+ avatar_defaults.max_items = #avatars;
+ end
for _, avatar in ipairs(avatars) do
- local ok, err = pep_service:publish("urn:xmpp:avatar:data", actor, avatar.hash, avatar.data, node_defaults)
+ local ok, err = pep_service:publish("urn:xmpp:avatar:data", actor, avatar.hash, avatar.data, avatar_defaults)
if ok then
- ok, err = pep_service:publish("urn:xmpp:avatar:metadata", actor, avatar.hash, avatar.meta, node_defaults);
+ ok, err = pep_service:publish("urn:xmpp:avatar:metadata", actor, avatar.hash, avatar.meta, avatar_defaults);
end
if not ok then
return ok, err;