From 863c5afa911a647acc74a8e56aee4a79a6a21975 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Mon, 23 Jun 2025 11:50:59 -0400 Subject: [PATCH] Kick from MUCs on transport shutdown --- telegram/connect.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/telegram/connect.go b/telegram/connect.go index d37c5fd..b332352 100644 --- a/telegram/connect.go +++ b/telegram/connect.go @@ -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