Skip to content

Commit b9e9ac8

Browse files
committed
Improvements
1 parent ec00826 commit b9e9ac8

File tree

4 files changed

+65
-10
lines changed

4 files changed

+65
-10
lines changed

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

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,7 @@ public void joinConferenceRoom()
837837
// the room)
838838
inviteTimeout.scheduleTimeout();
839839

840-
this.getConnection()
841-
.addAsyncStanzaListener(this.roomConfigurationListener,
842-
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
840+
registerRoomConfigurationChange();
843841

844842
if (StringUtils.isNullOrEmpty(roomPassword))
845843
{
@@ -1057,10 +1055,8 @@ private void onJvbCallEnded()
10571055

10581056
private void leaveConferenceRoom()
10591057
{
1060-
if (roomConfigurationListener != null)
1061-
{
1062-
this.getConnection().removeAsyncStanzaListener(this.roomConfigurationListener);
1063-
}
1058+
1059+
unregisterRoomConfigurationChange();
10641060

10651061
if (this.jitsiMeetTools != null)
10661062
{
@@ -2141,9 +2137,22 @@ private void onAllowedToUnmute()
21412137
/**
21422138
* Called when room configuration has changed.
21432139
*/
2144-
private void onRoomConfigurationChanged() {
2145-
try {
2146-
if (this.mucRoom != null) {
2140+
private void onRoomConfigurationChanged()
2141+
{
2142+
try
2143+
{
2144+
if (this.mucRoom != null)
2145+
{
2146+
/**
2147+
* Check the room configuration only if force mute is enabled.
2148+
* This should probably be in jitsi SDK.
2149+
*/
2150+
2151+
if (!this.forceMute.enabled())
2152+
{
2153+
return;
2154+
}
2155+
21472156
ServiceDiscoveryManager serviceDiscoveryManager
21482157
= ServiceDiscoveryManager.getInstanceFor(this.getConnection());
21492158

@@ -2187,5 +2196,39 @@ private void onRoomConfigurationChanged() {
21872196
logger.error(ex.toString());
21882197
}
21892198
}
2199+
2200+
/**
2201+
*
2202+
*/
2203+
private void registerRoomConfigurationChange()
2204+
{
2205+
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
2206+
{
2207+
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
2208+
.getConnection();
2209+
2210+
xmppConnection
2211+
.addAsyncStanzaListener(this.roomConfigurationListener,
2212+
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
2213+
}
2214+
}
2215+
2216+
/**
2217+
*
2218+
*/
2219+
private void unregisterRoomConfigurationChange()
2220+
{
2221+
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
2222+
{
2223+
if (roomConfigurationListener != null)
2224+
{
2225+
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
2226+
.getConnection();
2227+
2228+
xmppConnection
2229+
.removeAsyncStanzaListener(this.roomConfigurationListener);
2230+
}
2231+
}
2232+
}
21902233
}
21912234

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)