mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-03 15:16:58 +02:00
Update to 2025-06-16 16:00
This commit is contained in:
@@ -12,13 +12,10 @@ local st = require 'util.stanza';
|
||||
local jid = require 'util.jid';
|
||||
local new_id = require 'util.id'.medium;
|
||||
local util = module:require 'util';
|
||||
local is_admin = util.is_admin;
|
||||
local presence_check_status = util.presence_check_status;
|
||||
local process_host_module = util.process_host_module;
|
||||
|
||||
local um_is_admin = require 'core.usermanager'.is_admin;
|
||||
local function is_admin(jid)
|
||||
return um_is_admin(jid, module.host);
|
||||
end
|
||||
local is_transcriber_jigasi = util.is_transcriber_jigasi;
|
||||
|
||||
local MUC_NS = 'http://jabber.org/protocol/muc';
|
||||
|
||||
@@ -57,7 +54,7 @@ local function send_visitors_iq(conference_service, room, type)
|
||||
-- send iq informing the vnode that the connect is done and it will allow visitors to join
|
||||
local iq_id = new_id();
|
||||
sent_iq_cache:set(iq_id, socket.gettime());
|
||||
local connect_done = st.iq({
|
||||
local visitors_iq = st.iq({
|
||||
type = 'set',
|
||||
to = conference_service,
|
||||
from = module.host,
|
||||
@@ -68,11 +65,24 @@ local function send_visitors_iq(conference_service, room, type)
|
||||
password = type ~= 'disconnect' and room:get_password() or '',
|
||||
lobby = room._data.lobbyroom and 'true' or 'false',
|
||||
meetingId = room._data.meetingId,
|
||||
moderatorId = room._data.moderator_id, -- can be used from external modules to set single moderator for meetings
|
||||
createdTimestamp = room.created_timestamp and tostring(room.created_timestamp) or nil
|
||||
}):up();
|
||||
});
|
||||
|
||||
module:send(connect_done);
|
||||
if type == 'update' then
|
||||
visitors_iq:tag('moderators', { xmlns = 'jitsi:visitors' });
|
||||
|
||||
for _, o in room:each_occupant() do
|
||||
if not is_admin(o.bare_jid) and o.role == 'moderator' then
|
||||
visitors_iq:tag('item', { epId = jid.resource(o.nick) }):up();
|
||||
end
|
||||
end
|
||||
|
||||
visitors_iq:up();
|
||||
end
|
||||
|
||||
visitors_iq:up();
|
||||
|
||||
module:send(visitors_iq);
|
||||
end
|
||||
|
||||
-- an event received from visitors component, which receives iqs from jicofo
|
||||
@@ -96,6 +106,9 @@ local function connect_vnode(event)
|
||||
|
||||
local sent_main_participants = 0;
|
||||
|
||||
-- send update initially so we can report the moderators that will join
|
||||
send_visitors_iq(conference_service, room, 'update');
|
||||
|
||||
for _, o in room:each_occupant() do
|
||||
if not is_admin(o.bare_jid) then
|
||||
local fmuc_pr = st.clone(o:get_presence());
|
||||
@@ -185,7 +198,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
|
||||
-- filter focus and configured domains (used for jibri and transcribers)
|
||||
if is_admin(stanza.attr.from) or visitors_nodes[room.jid] == nil
|
||||
or ignore_list:contains(jid.host(occupant.bare_jid)) then
|
||||
or (ignore_list:contains(jid.host(occupant.bare_jid)) and not is_transcriber_jigasi(stanza)) then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -206,7 +219,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
|
||||
-- ignore configured domains (jibri and transcribers)
|
||||
if is_admin(occupant.bare_jid) or visitors_nodes[room.jid] == nil or visitors_nodes[room.jid].nodes == nil
|
||||
or ignore_list:contains(jid.host(occupant.bare_jid)) then
|
||||
or (ignore_list:contains(jid.host(occupant.bare_jid)) and not is_transcriber_jigasi(stanza)) then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -249,7 +262,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
|
||||
-- filter focus, ignore configured domains (jibri and transcribers)
|
||||
if is_admin(stanza.attr.from) or visitors_nodes[room.jid] == nil
|
||||
or ignore_list:contains(jid.host(occupant.bare_jid)) then
|
||||
or (ignore_list:contains(jid.host(occupant.bare_jid)) and not is_transcriber_jigasi(stanza)) then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -257,6 +270,10 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
local user, _, res = jid.split(occupant.nick);
|
||||
-- a main participant we need to update all active visitor nodes
|
||||
for k in pairs(vnodes) do
|
||||
if occupant.role == 'moderator' then
|
||||
-- first send that the participant is a moderator
|
||||
send_visitors_iq(k, room, 'update');
|
||||
end
|
||||
local fmuc_pr = st.clone(stanza);
|
||||
fmuc_pr.attr.to = jid.join(user, k, res);
|
||||
fmuc_pr.attr.from = occupant.jid;
|
||||
@@ -268,7 +285,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
local room, stanza, occupant = event.room, event.stanza, event.occupant;
|
||||
|
||||
-- filter sending messages from transcribers/jibris to visitors
|
||||
if not visitors_nodes[room.jid] or ignore_list:contains(jid.host(occupant.bare_jid)) then
|
||||
if not visitors_nodes[room.jid] then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -296,6 +313,11 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
return;
|
||||
end
|
||||
|
||||
if host_module:fire_event('jitsi-visitor-groupchat-pre-route', event) then
|
||||
-- message filtered
|
||||
return;
|
||||
end
|
||||
|
||||
-- a message from visitor occupant of known visitor node
|
||||
stanza.attr.from = to;
|
||||
for _, o in room:each_occupant() do
|
||||
@@ -331,6 +353,21 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||
end
|
||||
end
|
||||
end, -100); -- we want to run last in order to check is the status code 104
|
||||
|
||||
host_module:hook('muc-set-affiliation', function (event)
|
||||
if event.actor and not is_admin(event.actor) and event.affiliation == 'owner' then
|
||||
local room = event.room;
|
||||
|
||||
if not visitors_nodes[room.jid] then
|
||||
return;
|
||||
end
|
||||
-- we need to update all vnodes
|
||||
local vnodes = visitors_nodes[room.jid].nodes;
|
||||
for conference_service in pairs(vnodes) do
|
||||
send_visitors_iq(conference_service, room, 'update');
|
||||
end
|
||||
end
|
||||
end, -2);
|
||||
end);
|
||||
|
||||
module:hook('jitsi-lobby-enabled', function(event)
|
||||
|
Reference in New Issue
Block a user