Kick from MUCs on transport shutdown

This commit is contained in:
Bohdan Horbeshko 2025-06-23 11:50:59 -04:00
parent 0b1e204912
commit 863c5afa91

View file

@ -234,6 +234,21 @@ func (c *Client) Disconnect(resource string, quit bool) bool {
c.sendPresence(args...)
}
if c.Session.MUC {
c.locks.mucCacheLock.Lock()
for chatID := range c.mucCache {
c.sendPresence(
gateway.SPFrom(gateway.MUCNODE(chatID)),
gateway.SPResource(c.GetMUCNickname(0)),
gateway.SPType("unavailable"),
gateway.SPMUCAffiliation("none"),
gateway.SPMUCRole("none"),
gateway.SPMUCStatusCodes([]uint16{110, 332}),
)
}
c.locks.mucCacheLock.Unlock()
}
c.close()
return true