fix(jiconop): Fixes loading it under different virtual hosts.

This commit is contained in:
damencho
2025-08-19 13:16:51 -05:00
committed by Дамян Минков
parent dac9b5e244
commit b0a96b32d2

View File

@@ -7,6 +7,12 @@ local services_xml = ext_services.services_xml;
-- gathers needed information and pushes it with a message to clients
-- this way we skip 4 request responses during every client setup
local main_virtual_host = module:get_option_string('muc_mapper_domain_base');
if not main_virtual_host then
module:log('warn', 'No muc_mapper_domain_base option set.');
return;
end
local shard_name_config = module:get_option_string('shard_name');
if shard_name_config then
module:add_identity("server", "shard", shard_name_config);
@@ -33,7 +39,8 @@ module:hook("resource-bind", function (event)
-- disco info data / all identity and features
local query = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" });
local done = {};
for _,identity in ipairs(module:get_host_items("identity")) do
-- to lod this module in different virtual hosts than the main, make sure we query here for main
for _,identity in ipairs(module:context(main_virtual_host):get_host_items("identity")) do
local identity_s = identity.category.."\0"..identity.type;
if not done[identity_s] then
query:tag("identity", identity):up();