aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-06-30 16:54:39 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-06-30 16:54:39 +0300
commit30b3fd16153fab727315f014150d98b367ccd6ad (patch)
tree98e2c0193447e131cf77ce44050d5068c6a7f24c /telegram/utils.go
parentf8ad8c0204e2effabce4545c91992146a560168d (diff)
Force update nicknames via PubSub and presences on reconnect
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 58f7712..a9e0bc8 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -1332,3 +1332,18 @@ func (c *Client) GetVcardInfo(toID int64) (VCardInfo, error) {
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)
+ }
+ }
+}