Skip to content

Commit bb6271c

Browse files
committed
Improvements
1 parent bd8ea01 commit bb6271c

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

src/main/java/org/jitsi/jigasi/JvbConference.java

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,7 @@ public void joinConferenceRoom()
828828
// the room)
829829
inviteTimeout.scheduleTimeout();
830830

831-
this.getConnection()
832-
.addAsyncStanzaListener(this.roomConfigurationListener,
833-
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
831+
registerRoomConfigurationChange();
834832

835833
if (StringUtils.isNullOrEmpty(roomPassword))
836834
{
@@ -1048,10 +1046,8 @@ private void onJvbCallEnded()
10481046

10491047
private void leaveConferenceRoom()
10501048
{
1051-
if (roomConfigurationListener != null)
1052-
{
1053-
this.getConnection().removeAsyncStanzaListener(this.roomConfigurationListener);
1054-
}
1049+
1050+
unregisterRoomConfigurationChange();
10551051

10561052
if (this.jitsiMeetTools != null)
10571053
{
@@ -2099,6 +2095,16 @@ private void onRoomConfigurationChanged()
20992095
{
21002096
if (this.mucRoom != null)
21012097
{
2098+
/**
2099+
* Check the room configuration only if force mute is enabled.
2100+
* This should probably be in jitsi SDK.
2101+
*/
2102+
2103+
if (!this.forceMute.enabled())
2104+
{
2105+
return;
2106+
}
2107+
21022108
ServiceDiscoveryManager serviceDiscoveryManager
21032109
= ServiceDiscoveryManager.getInstanceFor(this.getConnection());
21042110

@@ -2151,4 +2157,38 @@ private void onRoomConfigurationChanged()
21512157
logger.error(ex.toString());
21522158
}
21532159
}
2160+
2161+
/**
2162+
*
2163+
*/
2164+
private void registerRoomConfigurationChange()
2165+
{
2166+
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
2167+
{
2168+
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
2169+
.getConnection();
2170+
2171+
xmppConnection
2172+
.addAsyncStanzaListener(this.roomConfigurationListener,
2173+
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
2174+
}
2175+
}
2176+
2177+
/**
2178+
*
2179+
*/
2180+
private void unregisterRoomConfigurationChange()
2181+
{
2182+
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
2183+
{
2184+
if (roomConfigurationListener != null)
2185+
{
2186+
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
2187+
.getConnection();
2188+
2189+
xmppConnection
2190+
.removeAsyncStanzaListener(this.roomConfigurationListener);
2191+
}
2192+
}
2193+
}
21542194
}

src/main/java/org/jitsi/jigasi/mute/ForceMute.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ public interface ForceMute
55
void requestAudioMute(boolean muted);
66

77
void setAllowedToSpeak(boolean allowedToSpeak);
8+
9+
boolean enabled();
810
}

src/main/java/org/jitsi/jigasi/mute/ForceMuteDisabled.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ public void setAllowedToSpeak(boolean allowedToSpeak)
2424
{
2525

2626
}
27+
28+
@Override
29+
public boolean enabled() {
30+
return false;
31+
}
2732
}

src/main/java/org/jitsi/jigasi/mute/ForceMuteEnabled.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ public void setAllowedToSpeak(boolean allowedToSpeak)
3636
{
3737
this.allowedToSpeak = allowedToSpeak;
3838
}
39+
40+
@Override
41+
public boolean enabled() {
42+
return true;
43+
}
3944
}

0 commit comments

Comments
 (0)