Skip to content

Commit

Permalink
fix: Always send presence unavailable when leaving a MUC. (jitsi#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Nov 14, 2023
1 parent 8a5d4c9 commit 600217b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ class ChatRoomImpl(
// listeners lingering around
if (isJoined) {
muc.leave()
} else {
// If the join attempt timed out the XMPP server might have processed it and created the MUC, and
// since the XMPP connection is long-lived the MUC will leak.
val leavePresence = connection.stanzaFactory.buildPresenceStanza()
.ofType(Presence.Type.unavailable)
.to(myOccupantJid)
.build()
connection.sendStanza(leavePresence)
}
} catch (e: Exception) {
// when the connection is not connected or we get NotConnectedException, this is expected (skip log)
Expand Down

0 comments on commit 600217b

Please sign in to comment.