Force update nicknames via PubSub and presences on reconnect

This commit is contained in:
Bohdan Horbeshko 2023-06-30 09:54:39 -04:00
parent f8ad8c0204
commit 30b3fd1615
2 changed files with 16 additions and 0 deletions

View file

@ -1332,3 +1332,18 @@ func (c *Client) GetVcardInfo(toID int64) (VCardInfo, error) {
return info, nil return info, nil
} }
func (c *Client) UpdateChatNicknames() {
for _, id := range c.cache.ChatsKeys() {
chat, ok := c.cache.GetChat(id)
if ok {
gateway.SendPresence(
c.xmpp,
c.jid,
gateway.SPFrom(strconv.FormatInt(id, 10)),
gateway.SPNickname(chat.Title),
)
gateway.SetNickname(c.jid, strconv.FormatInt(id, 10), chat.Title, c.xmpp)
}
}
}

View file

@ -342,6 +342,7 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) {
gateway.SPImmed(false), gateway.SPImmed(false),
) )
} }
session.UpdateChatNicknames()
} }
}() }()
} }