Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cristifg committed Oct 18, 2020
1 parent ec00826 commit b9e9ac8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 10 deletions.
63 changes: 53 additions & 10 deletions src/main/java/org/jitsi/jigasi/JvbConference.java
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,7 @@ public void joinConferenceRoom()
// the room)
inviteTimeout.scheduleTimeout();

this.getConnection()
.addAsyncStanzaListener(this.roomConfigurationListener,
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
registerRoomConfigurationChange();

if (StringUtils.isNullOrEmpty(roomPassword))
{
Expand Down Expand Up @@ -1057,10 +1055,8 @@ private void onJvbCallEnded()

private void leaveConferenceRoom()
{
if (roomConfigurationListener != null)
{
this.getConnection().removeAsyncStanzaListener(this.roomConfigurationListener);
}

unregisterRoomConfigurationChange();

if (this.jitsiMeetTools != null)
{
Expand Down Expand Up @@ -2141,9 +2137,22 @@ private void onAllowedToUnmute()
/**
* Called when room configuration has changed.
*/
private void onRoomConfigurationChanged() {
try {
if (this.mucRoom != null) {
private void onRoomConfigurationChanged()
{
try
{
if (this.mucRoom != null)
{
/**
* Check the room configuration only if force mute is enabled.
* This should probably be in jitsi SDK.
*/

if (!this.forceMute.enabled())
{
return;
}

ServiceDiscoveryManager serviceDiscoveryManager
= ServiceDiscoveryManager.getInstanceFor(this.getConnection());

Expand Down Expand Up @@ -2187,5 +2196,39 @@ private void onRoomConfigurationChanged() {
logger.error(ex.toString());
}
}

/**
*
*/
private void registerRoomConfigurationChange()
{
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
{
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
.getConnection();

xmppConnection
.addAsyncStanzaListener(this.roomConfigurationListener,
new StanzaTypeFilter(org.jivesoftware.smack.packet.Message.class));
}
}

/**
*
*/
private void unregisterRoomConfigurationChange()
{
if (this.xmppProvider instanceof ProtocolProviderServiceJabberImpl)
{
if (roomConfigurationListener != null)
{
XMPPConnection xmppConnection = ((ProtocolProviderServiceJabberImpl) this.xmppProvider)
.getConnection();

xmppConnection
.removeAsyncStanzaListener(this.roomConfigurationListener);
}
}
}
}

2 changes: 2 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMute.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ public interface ForceMute
void requestAudioMute(boolean muted);

void setAllowedToSpeak(boolean allowedToSpeak);

boolean enabled();
}
5 changes: 5 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMuteDisabled.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ public void setAllowedToSpeak(boolean allowedToSpeak)
{

}

@Override
public boolean enabled() {
return false;
}
}
5 changes: 5 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMuteEnabled.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ public void setAllowedToSpeak(boolean allowedToSpeak)
{
this.allowedToSpeak = allowedToSpeak;
}

@Override
public boolean enabled() {
return true;
}
}

0 comments on commit b9e9ac8

Please sign in to comment.