mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Purge delayed statuses for legacy groups before migration
This commit is contained in:
parent
76919e0c96
commit
a5a3fdf688
1 changed files with 13 additions and 2 deletions
|
|
@ -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
|
// MigrateToMUCs unsubscribes from legacy group chats and invites to MUCs
|
||||||
func (c *Client) MigrateToMUCs() {
|
func (c *Client) MigrateToMUCs() {
|
||||||
|
var chatIDs []int64
|
||||||
for _, chat := range c.GetGroupChats() {
|
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() {
|
for resource := range c.resourcesRange() {
|
||||||
gateway.InviteToMUC(chat.Id, c.jid+"/"+resource, c.xmpp)
|
gateway.InviteToMUC(chatID, c.jid+"/"+resource, c.xmpp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue