Skip to content

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

fix(breakout-rooms): reply with an error for an invalid breakout room (#17740)

bgrozevb8da0e13da89
diff --git a/resources/prosody-plugins/mod_muc_breakout_rooms.lua b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
index a91e48659d..2f6debc83b 100644
--- a/resources/prosody-plugins/mod_muc_breakout_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
@@ -381,6 +381,16 @@ function on_breakout_room_pre_create(event)
breakout_room:set_subject(breakout_room.jid, main_room._data.breakout_rooms[breakout_room.jid]);
else
module:log('debug', 'Invalid breakout room %s will not be created.', breakout_room.jid);
+
+ -- Tell the client that the join failed. Without this reply the join presence is
+ -- dropped without an answer, and the client waits until its own timeout.
+ -- Prosody sends an error for restrict_room_creation, but that handler and this one
+ -- both use the default priority, so the order between the two is not defined.
+ if event.origin and event.stanza then
+ event.origin.send(st.error_reply(
+ event.stanza, 'cancel', 'item-not-found', 'Breakout room is invalid.'));
+ end
+
breakout_room:destroy(main_room_jid, 'Breakout room is invalid.');
return true;
end