Skip to content

Commit 600217b

Browse files
authored
fix: Always send presence unavailable when leaving a MUC. (#1122)
1 parent 8a5d4c9 commit 600217b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/muc/ChatRoomImpl.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,14 @@ class ChatRoomImpl(
280280
// listeners lingering around
281281
if (isJoined) {
282282
muc.leave()
283+
} else {
284+
// If the join attempt timed out the XMPP server might have processed it and created the MUC, and
285+
// since the XMPP connection is long-lived the MUC will leak.
286+
val leavePresence = connection.stanzaFactory.buildPresenceStanza()
287+
.ofType(Presence.Type.unavailable)
288+
.to(myOccupantJid)
289+
.build()
290+
connection.sendStanza(leavePresence)
283291
}
284292
} catch (e: Exception) {
285293
// when the connection is not connected or we get NotConnectedException, this is expected (skip log)

0 commit comments

Comments
 (0)