Skip to content

Commit

Permalink
fix: Skip sending duplicate identical presences.
Browse files Browse the repository at this point in the history
In this case removing the extension BridgeNotAvailablePacketExt from presence on every onColibriConferenceAllocated, was resending last presence.
  • Loading branch information
damencho committed Jan 6, 2021
1 parent 7db3d1f commit b4f34c4
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/java/org/jitsi/impl/protocol/xmpp/ChatRoomImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -983,32 +983,38 @@ public void setPresenceExtension(ExtensionElement extension,
XmppProtocolProvider xmppProtocolProvider
= (XmppProtocolProvider) getParentProvider();

boolean presenceUpdated = false;

// Remove old
ExtensionElement old
= lastPresenceSent.getExtension(
extension.getElementName(), extension.getNamespace());
if (old != null)
{
lastPresenceSent.removeExtension(old);
presenceUpdated = true;
}

if (!remove)
{
// Add new
lastPresenceSent.addExtension(extension);
presenceUpdated = true;
}

XmppConnection connection = xmppProtocolProvider.getConnectionAdapter();
if (connection == null)
if (presenceUpdated)
{
logger.error("Failed to send presence extension - no connection");
return;
}
XmppConnection connection = xmppProtocolProvider.getConnectionAdapter();
if (connection == null) {
logger.error("Failed to send presence extension - no connection");
return;
}

// Reset the stanza ID before sending
lastPresenceSent.setStanzaId(null);
// Reset the stanza ID before sending
lastPresenceSent.setStanzaId(null);

connection.sendStanza(lastPresenceSent);
connection.sendStanza(lastPresenceSent);
}
}

/**
Expand Down

0 comments on commit b4f34c4

Please sign in to comment.