-- cgit v1.2.3 From f78abda947708f72af2eb948b7ed52f08fd39fe4 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 11 Sep 2019 15:03:54 +0100 Subject: prosodyctl: Fix traceback on incorrect proxy65_address type --- prosodyctl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/prosodyctl b/prosodyctl index e580446b..405ef1f8 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1103,17 +1103,21 @@ function commands.check(arg) if modules:contains("proxy65") then local proxy65_target = configmanager.get(host, "proxy65_address") or host; - local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA"); - local prob = {}; - if not A then - table.insert(prob, "A"); - end - if v6_supported and not AAAA then - table.insert(prob, "AAAA"); - end - if #prob > 0 then - print(" File transfer proxy "..proxy65_target.." has no "..table.concat(prob, "/") - .." record. Create one or set 'proxy65_address' to the correct host/IP."); + if type(proxy65_target) == "string" then + local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA"); + local prob = {}; + if not A then + table.insert(prob, "A"); + end + if v6_supported and not AAAA then + table.insert(prob, "AAAA"); + end + if #prob > 0 then + print(" File transfer proxy "..proxy65_target.." has no "..table.concat(prob, "/") + .." record. Create one or set 'proxy65_address' to the correct host/IP."); + end + else + print(" proxy65_address for "..host.." should be set to a string, unable to perform DNS check"); end end -- cgit v1.2.3 From 70427ffd2b92953d4868ed9fd97ea1bf0480c492 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 21 Sep 2019 15:20:50 +0200 Subject: mod_vcard_legacy: Advertise lack of avatar correctly (fixes #1431) (thanks lovetox) --- plugins/mod_vcard_legacy.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index ab2c4490..6229b931 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -301,10 +301,10 @@ local function inject_xep153(event) local pep_service = mod_pep.get_pep_service(username); stanza:remove_children("x", "vcard-temp:x:update"); - local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }); + local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }):tag("photo"); local ok, avatar_hash = pep_service:get_last_item("urn:xmpp:avatar:metadata", true); if ok and avatar_hash then - x_update:text_tag("photo", avatar_hash); + x_update:text(avatar_hash); end stanza:add_direct_child(x_update); end -- cgit v1.2.3 From ae7a763b275c6306e6c6dcb19e624c1255158d8e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 21 Sep 2019 16:29:16 +0200 Subject: mod_vcard_legacy: Don't owerwrite empty photo elements (fixes #1432) --- plugins/mod_vcard_legacy.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index 6229b931..5e75947a 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -300,13 +300,19 @@ local function inject_xep153(event) if stanza.attr.type then return end local pep_service = mod_pep.get_pep_service(username); - stanza:remove_children("x", "vcard-temp:x:update"); - local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }):tag("photo"); + local x_update = stanza:get_child("x", "vcard-temp:x:update"); + if not x_update then + x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }):tag("photo"); + stanza:add_direct_child(x_update); + elseif x_update:get_child("photo") then + return; -- XEP implies that these should be left alone + else + x_update:tag("photo"); + end local ok, avatar_hash = pep_service:get_last_item("urn:xmpp:avatar:metadata", true); if ok and avatar_hash then x_update:text(avatar_hash); end - stanza:add_direct_child(x_update); end module:hook("pre-presence/full", inject_xep153, 1); -- cgit v1.2.3