|
@@ -197,6 +197,7 @@ function create_breakout_room(room_jid, subject)
|
197
|
197
|
main_room._data.breakout_rooms = {};
|
198
|
198
|
end
|
199
|
199
|
main_room._data.breakout_rooms[breakout_room_jid] = subject;
|
|
200
|
+ main_room._data.breakout_rooms_active = true;
|
200
|
201
|
-- Make room persistent - not to be destroyed - if all participants join breakout rooms.
|
201
|
202
|
main_room:set_persistent(true);
|
202
|
203
|
main_room:save(true);
|
|
@@ -300,7 +301,7 @@ function on_breakout_room_pre_create(event)
|
300
|
301
|
local main_room, main_room_jid = get_main_room(breakout_room.jid);
|
301
|
302
|
|
302
|
303
|
-- Only allow existent breakout rooms to be started.
|
303
|
|
- -- Authorisation of breakout rooms is done by their random uuid suffix
|
|
304
|
+ -- Authorisation of breakout rooms is done by their random uuid name
|
304
|
305
|
if main_room and main_room._data.breakout_rooms and main_room._data.breakout_rooms[breakout_room.jid] then
|
305
|
306
|
breakout_room._data.subject = main_room._data.breakout_rooms[breakout_room.jid];
|
306
|
307
|
breakout_room.save();
|
|
@@ -320,14 +321,16 @@ function on_occupant_joined(event)
|
320
|
321
|
|
321
|
322
|
local main_room = get_main_room(room.jid);
|
322
|
323
|
|
323
|
|
- if jid_node(event.occupant.jid) ~= 'focus' then
|
324
|
|
- broadcast_breakout_rooms(room.jid);
|
325
|
|
- end
|
|
324
|
+ if main_room._data.breakout_rooms_active then
|
|
325
|
+ if jid_node(event.occupant.jid) ~= 'focus' then
|
|
326
|
+ broadcast_breakout_rooms(room.jid);
|
|
327
|
+ end
|
326
|
328
|
|
327
|
|
- -- Prevent closing all rooms if a participant has joined (see on_occupant_left).
|
328
|
|
- if (main_room._data.is_close_all_scheduled) then
|
329
|
|
- main_room._data.is_close_all_scheduled = false;
|
330
|
|
- main_room:save();
|
|
329
|
+ -- Prevent closing all rooms if a participant has joined (see on_occupant_left).
|
|
330
|
+ if main_room._data.is_close_all_scheduled then
|
|
331
|
+ main_room._data.is_close_all_scheduled = false;
|
|
332
|
+ main_room:save();
|
|
333
|
+ end
|
331
|
334
|
end
|
332
|
335
|
end
|
333
|
336
|
|
|
@@ -367,17 +370,17 @@ function on_occupant_left(event)
|
367
|
370
|
|
368
|
371
|
local main_room, main_room_jid = get_main_room(room.jid);
|
369
|
372
|
|
370
|
|
- if jid_node(event.occupant.jid) ~= 'focus' then
|
|
373
|
+ if main_room._data.breakout_rooms_active and jid_node(event.occupant.jid) ~= 'focus' then
|
371
|
374
|
broadcast_breakout_rooms(room.jid);
|
372
|
375
|
end
|
373
|
376
|
|
374
|
377
|
-- Close the conference if all left for good.
|
375
|
|
- if not main_room._data.is_close_all_scheduled and not exist_occupants_in_rooms(main_room) then
|
|
378
|
+ if main_room._data.breakout_rooms_active and not main_room._data.is_close_all_scheduled and not exist_occupants_in_rooms(main_room) then
|
376
|
379
|
main_room._data.is_close_all_scheduled = true;
|
377
|
380
|
main_room:save(true);
|
378
|
381
|
module:add_timer(ROOMS_TTL_IF_ALL_LEFT, function()
|
379
|
382
|
if main_room._data.is_close_all_scheduled then
|
380
|
|
- --module:log('info', 'Closing conference %s as all left for good.', main_room_jid);
|
|
383
|
+ module:log('info', 'Closing conference %s as all left for good.', main_room_jid);
|
381
|
384
|
main_room:set_persistent(false);
|
382
|
385
|
main_room:save(true);
|
383
|
386
|
main_room:destroy(main_room_jid, 'All occupants left.');
|