File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed
jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/muc
jicofo/src/main/java/org/jitsi/jicofo/conference Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ interface ChatRoom {
5555 /* * Whether a lobby is enabled for the room. Read from the MUC config form. */
5656 val lobbyEnabled: Boolean
5757
58+ /* * Whether the visitors feature is enabled for the room. Read from the MUC config form. */
59+ val visitorsEnabled: Boolean?
60+
61+ /* * The number of participants in the room after which new endpoints should be redirected to visitors.
62+ * Read from the MUC config form. */
63+ val participantsSoftLimit: Int?
64+
5865 val debugState: OrderedJsonObject
5966
6067 /* * Returns the number of members that currently have their audio sources unmuted. */
Original file line number Diff line number Diff line change @@ -140,6 +140,22 @@ class ChatRoomImpl(
140140 }
141141 }
142142
143+ override var visitorsEnabled: Boolean? = null
144+ private set(value) {
145+ if (value != field) {
146+ logger.info(" Visitors is now: $value " )
147+ field = value
148+ }
149+ }
150+
151+ override var participantsSoftLimit: Int? = null
152+ private set(value) {
153+ if (value != field) {
154+ logger.info(" ParticipantsSoftLimit is now $value ." )
155+ field = value
156+ }
157+ }
158+
143159 private val avModerationByMediaType = ConcurrentHashMap <MediaType , AvModerationForMediaType >()
144160
145161 /* * The emitter used to fire events. */
@@ -262,6 +278,10 @@ class ChatRoomImpl(
262278 private fun parseConfigForm (configForm : Form ) {
263279 lobbyEnabled =
264280 configForm.getField(MucConfigFormManager .MUC_ROOMCONFIG_MEMBERSONLY )?.firstValue?.toBoolean() ? : false
281+ visitorsEnabled =
282+ configForm.getField(MucConfigFields .VISITORS_ENABLED )?.firstValue?.toBoolean()
283+ participantsSoftLimit =
284+ configForm.getField(MucConfigFields .PARTICIPANTS_SOFT_LIMIT )?.firstValue?.toInt()
265285 }
266286
267287 override fun leave () {
@@ -544,6 +564,8 @@ class ChatRoomImpl(
544564 const val MAIN_ROOM = " muc#roominfo_breakout_main_room"
545565 const val MEETING_ID = " muc#roominfo_meetingId"
546566 const val WHOIS = " muc#roomconfig_whois"
567+ const val PARTICIPANTS_SOFT_LIMIT = " muc#roominfo_participantsSoftLimit"
568+ const val VISITORS_ENABLED = " muc#roominfo_visitorsEnabled"
547569 }
548570
549571 internal inner class MemberListener : ParticipantStatusListener {
Original file line number Diff line number Diff line change @@ -1677,7 +1677,7 @@ public String redirectVisitor(boolean visitorRequested)
16771677
16781678 // We don't support both visitors and a lobby. Once a lobby is enabled we don't use visitors anymore.
16791679 ChatRoom chatRoom = this .chatRoom ;
1680- if (chatRoom != null && chatRoom .getLobbyEnabled ())
1680+ if (chatRoom != null && ( chatRoom .getLobbyEnabled () || Boolean . FALSE . equals ( chatRoom . getVisitorsEnabled ()) ))
16811681 {
16821682 return null ;
16831683 }
@@ -1688,13 +1688,19 @@ public String redirectVisitor(boolean visitorRequested)
16881688 }
16891689
16901690 long participantCount = getUserParticipantCount ();
1691- boolean visitorsAlreadyUsed = false ;
1691+ boolean visitorsAlreadyUsed ;
16921692 synchronized (visitorChatRooms )
16931693 {
16941694 visitorsAlreadyUsed = !visitorChatRooms .isEmpty ();
16951695 }
16961696
1697- if (visitorsAlreadyUsed || visitorRequested || participantCount >= VisitorsConfig .config .getMaxParticipants ())
1697+ int participantsSoftLimit = VisitorsConfig .config .getMaxParticipants ();
1698+ if (chatRoom != null && chatRoom .getParticipantsSoftLimit () != null && chatRoom .getParticipantsSoftLimit () > 0 )
1699+ {
1700+ participantsSoftLimit = chatRoom .getParticipantsSoftLimit ();
1701+ }
1702+
1703+ if (visitorsAlreadyUsed || visitorRequested || participantCount >= participantsSoftLimit )
16981704 {
16991705 return selectVisitorNode ();
17001706 }
You can’t perform that action at this time.
0 commit comments