Avoid a delay when adding a new resource

This commit is contained in:
Bohdan Horbeshko 2026-08-10 13:32:57 -04:00
parent 535423398a
commit 220083df74

View file

@ -2410,18 +2410,20 @@ func (c *Client) roster(resource string) {
if _, ok := c.resources[resource]; ok { if _, ok := c.resources[resource]; ok {
c.locks.resourcesLock.Unlock() c.locks.resourcesLock.Unlock()
return // we know it return // we know it
} else if resource != "" {
c.resources[resource] = true
} }
c.locks.resourcesLock.Unlock() c.locks.resourcesLock.Unlock()
log.Warnf("Sending roster for %v", resource) log.Warnf("Sending roster for %v", resource)
for _, chat := range c.cache.OwnChatsKeys() { go func() {
c.ProcessStatusUpdate(chat, "", "", true) for _, chat := range c.cache.OwnChatsKeys() {
} c.ProcessStatusUpdate(chat, "", "", true)
}
}()
c.sendPresence(gateway.SPStatus("Logged in as: " + c.Session.Login)) c.sendPresence(gateway.SPStatus("Logged in as: " + c.Session.Login))
c.addResource(resource)
} }
// get last messages from specified chat // get last messages from specified chat