Purge delayed statuses for legacy groups before migration

This commit is contained in:
Bohdan Horbeshko 2025-05-09 22:32:17 -04:00
parent 76919e0c96
commit a5a3fdf688

View file

@ -2354,10 +2354,21 @@ func (c *Client) GetChatMembers(chatID int64, limited bool, query string, member
// MigrateToMUCs unsubscribes from legacy group chats and invites to MUCs
func (c *Client) MigrateToMUCs() {
var chatIDs []int64
for _, chat := range c.GetGroupChats() {
c.unsubscribe(chat.Id)
chatIDs = append(chatIDs, chat.Id)
}
c.DelayedStatusesLock.Lock()
for _, chatID := range chatIDs {
delete(c.DelayedStatuses, chatID)
}
c.DelayedStatusesLock.Unlock()
for _, chatID := range chatIDs {
c.unsubscribe(chatID)
for resource := range c.resourcesRange() {
gateway.InviteToMUC(chat.Id, c.jid+"/"+resource, c.xmpp)
gateway.InviteToMUC(chatID, c.jid+"/"+resource, c.xmpp)
}
}
}