Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(visitors): Allow occupants switching from breakout to main room.

damencho09d57972af71
diff --git a/resources/prosody-plugins/mod_muc_breakout_rooms.lua b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
index fb763f7180..d7783b427a 100644
--- a/resources/prosody-plugins/mod_muc_breakout_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
@@ -416,6 +416,16 @@ function exist_occupants_in_rooms(main_room)
return false;
end
+function on_occupant_pre_leave(event)
+ local room, occupant, session, stanza = event.room, event.occupant, event.origin, event.stanza;
+
+ local main_room = get_main_room(room.jid);
+
+ prosody.events.fire_event('jitsi-breakout-occupant-leaving', {
+ room = room; main_room = main_room; occupant = occupant; stanza = stanza; session = session;
+ });
+end
+
function on_occupant_left(event)
local room_jid = event.room.jid;
@@ -510,6 +520,7 @@ function process_breakout_rooms_muc_loaded(breakout_rooms_muc, host_module)
host_module:hook('muc-occupant-joined', on_occupant_joined);
host_module:hook('muc-occupant-left', on_occupant_left);
host_module:hook('muc-room-pre-create', on_breakout_room_pre_create);
+ host_module:hook('muc-occupant-pre-leave', on_occupant_pre_leave);
host_module:hook('muc-disco#info', function (event)
local room = event.room;
diff --git a/resources/prosody-plugins/mod_visitors_component.lua b/resources/prosody-plugins/mod_visitors_component.lua
index 290e74ae45..2ce70c5f74 100644
--- a/resources/prosody-plugins/mod_visitors_component.lua
+++ b/resources/prosody-plugins/mod_visitors_component.lua
@@ -636,3 +636,22 @@ prosody.events.add_handler('pre-jitsi-authentication', function(session)
return session.customusername;
end
end);
+
+-- when occupant is leaving breakout to join the main room and visitors are enabled
+-- make sure we will allow that participant to join as it is already part of the main room
+function handle_occupant_leaving_breakout(event)
+ local main_room, occupant, stanza = event.main_room, event.occupant, event.stanza;
+ local presence_status = stanza:get_child_text('status');
+
+ if presence_status ~= 'switch_room' or not visitors_promotion_map[main_room.jid] then
+ return;
+ end
+
+ local node = jid.node(occupant.bare_jid);
+
+ visitors_promotion_map[main_room.jid][node] = {
+ from = 'none';
+ jid = occupant.bare_jid;
+ };
+end
+module:hook_global('jitsi-breakout-occupant-leaving', handle_occupant_leaving_breakout);