mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 21:57:45 +03:00
mod_vcard_legacy: Adapt node defaults to number of avatars
This commit is contained in:
parent
47887761c6
commit
cc4a160cdb
1 changed files with 10 additions and 2 deletions
|
@ -254,10 +254,18 @@ function save_to_pep(pep_service, actor, vcard4, avatars)
|
||||||
pep_service:purge("urn:xmpp:avatar:data", actor);
|
pep_service:purge("urn:xmpp:avatar:data", actor);
|
||||||
end
|
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
|
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
|
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
|
end
|
||||||
if not ok then
|
if not ok then
|
||||||
return ok, err;
|
return ok, err;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue