From 86d869a107b77ff539eb9b9063903ff7d9b4da0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 8 Mar 2024 13:08:01 -0600 Subject: [PATCH] fix(visitors): Fixes replacing visitor domain. (#14457) * fix(visitors): Fixes replacing visitor domain. Constructing the visitor room jid instead of doing a risky replacement. The problem is having a room like: [meet-jit-si-shard]someroomname@conference.meet.jit.si and replacing with 'meet.jit.si', the dots match the -. --- resources/prosody-plugins/mod_visitors_component.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/prosody-plugins/mod_visitors_component.lua b/resources/prosody-plugins/mod_visitors_component.lua index a1303d18daea..293198917827 100644 --- a/resources/prosody-plugins/mod_visitors_component.lua +++ b/resources/prosody-plugins/mod_visitors_component.lua @@ -95,11 +95,13 @@ local function request_promotion_received(room, from_jid, from_vnode, nick, time local iq_id = new_id(); sent_iq_cache:set(iq_id, socket.gettime()); + local node = jid.node(room.jid); + module:send(st.iq({ type='set', to = req_from, from = module.host, id = iq_id }) :tag('visitors', { xmlns='jitsi:visitors', - room = string.gsub(room.jid, muc_domain_base, req_from), + room = jid.join(node, muc_domain_prefix..'.'..req_from), focusjid = focus_jid }) :tag('promotion-response', { xmlns='jitsi:visitors', @@ -282,11 +284,13 @@ local function process_promotion_response(room, id, approved) local iq_id = new_id(); sent_iq_cache:set(iq_id, socket.gettime()); + local node = jid.node(room.jid); + module:send(st.iq({ type='set', to = req_from, from = module.host, id = iq_id }) :tag('visitors', { xmlns='jitsi:visitors', - room = string.gsub(room.jid, muc_domain_base, req_from), + room = jid.join(node, muc_domain_prefix..'.'..req_from), focusjid = focus_jid }) :tag('promotion-response', { xmlns='jitsi:visitors',