Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(lobby): Approve multiple participants.
damencho7291e1ef0043
diff --git a/react/features/lobby/actions.any.ts b/react/features/lobby/actions.any.tsindex 9053d651bd..085077d7aa 100644--- a/react/features/lobby/actions.any.ts+++ b/react/features/lobby/actions.any.ts@@ -116,9 +116,7 @@ export function admitMultiple(participants: Array<IKnockingParticipant>) {return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {const conference = getCurrentConference(getState);- participants.forEach(p => {- conference?.lobbyApproveAccess(p.id);- });+ conference?.lobbyApproveAccess(participants.map(p => p.id));};}diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.luaindex 56b62d14b1..d277bf88ae 100644--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua@@ -238,16 +238,6 @@ function destroy_lobby_room(room, newjid, message)endend--- handle multiple items at once-function handle_admin_query_set_command(self, origin, stanza)- for i=1,#stanza.tags[1] do- if handle_admin_query_set_command_item(self, origin, stanza, stanza.tags[1].tags[i]) then- return true;- end- end- return true;-end--- This is a copy of the function(handle_admin_query_set_command) from prosody 12 (d7857ef7843a)function handle_admin_query_set_command_item(self, origin, stanza, item)if not item then@@ -309,6 +299,58 @@ function handle_admin_query_set_command_item(self, origin, stanza, item)endend+-- this is extracted from prosody to handle multiple invites+function handle_mediated_invite(room, origin, stanza, payload, host_module)+ local invitee = jid_prep(payload.attr.to);+ if not invitee then+ origin.send(st.error_reply(stanza, "cancel", "jid-malformed"));+ return true;+ elseif host_module:fire_event("muc-pre-invite", {room = room, origin = origin, stanza = stanza}) then+ return true;+ end+ local invite = muc_util.filter_muc_x(st.clone(stanza));+ invite.attr.from = room.jid;+ invite.attr.to = invitee;+ invite:tag('x', {xmlns='http://jabber.org/protocol/muc#user'})+ :tag('invite', {from = stanza.attr.from;})+ :tag('reason'):text(payload:get_child_text("reason")):up()+ :up()+ :up();+ if not host_module:fire_event("muc-invite", {room = room, stanza = invite, origin = origin, incoming = stanza}) then+ room:route_stanza(invite);+ end+ return true;+end++local prosody_overrides = {+ -- handle multiple items at once+ handle_admin_query_set_command = function(self, origin, stanza)+ for i=1,#stanza.tags[1] do+ if handle_admin_query_set_command_item(self, origin, stanza, stanza.tags[1].tags[i]) then+ return true;+ end+ end+ return true;+ end,+ -- this is extracted from prosody to handle multiple invites+ handle_message_to_room = function(room, origin, stanza, host_module)+ local type = stanza.attr.type;+ if type == nil or type == "normal" then+ local x = stanza:get_child("x", "http://jabber.org/protocol/muc#user");+ if x then+ local handled = false;+ for _, payload in pairs(x.tags) do -- for payload in x:children() do+ if payload ~= nil and payload.name == "invite" and payload.attr.to then+ handled = true;+ handle_mediated_invite(room, origin, stanza, payload, host_module)+ end+ end+ return handled;+ end+ end+ end+};+-- operates on already loaded lobby muc modulefunction process_lobby_muc_loaded(lobby_muc, host_module)module:log('debug', 'Lobby muc loaded');@@ -520,8 +562,10 @@ process_host_module(main_muc_component_config, function(host_module, host)for event_name, method in pairs {-- Normal room interactions["iq-set/bare/http://jabber.org/protocol/muc#admin:query"] = "handle_admin_query_set_command" ;+ ["message/bare"] = "handle_message_to_room" ;-- Host room["iq-set/host/http://jabber.org/protocol/muc#admin:query"] = "handle_admin_query_set_command" ;+ ["message/host"] = "handle_message_to_room" ;} dohost_module:hook(event_name, function (event)local origin, stanza = event.origin, event.stanza;@@ -529,7 +573,7 @@ process_host_module(main_muc_component_config, function(host_module, host)local room = get_room_from_jid(room_jid);if room then- return handle_admin_query_set_command(room, origin, stanza);+ return prosody_overrides[method](room, origin, stanza, host_module);endend, 1) -- make sure we handle it before prosody that uses priority -2 for thisend