aboutsummaryrefslogtreecommitdiff
path: root/telegram/handlers.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-10-04 01:56:37 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-10-04 01:56:37 +0300
commit1e7e761c6ce7bda3850ed23d0e64d884a28f60a7 (patch)
tree4db6cc5ffc62ac91f4e662b2546a17fb62621e00 /telegram/handlers.go
parentb8a57c06b646edbad340c9e1c6c79e11a8a666e3 (diff)
Reflect name change of Telegram user in all MUCs
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r--telegram/handlers.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go
index 8facc10..c7185f5 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -153,6 +153,13 @@ func (c *Client) updateHandler() {
// new user discovered
func (c *Client) updateUser(update *client.UpdateUser) {
+ // check if MUC nicknames should be updated
+ cacheUser, ok := c.cache.GetUser(update.User.Id)
+ if ok && (cacheUser.FirstName != update.User.FirstName || cacheUser.LastName != update.User.LastName) {
+ newNickname := c.GetMUCNickname(update.User.Id)
+ c.updateMUCsNickname(update.User.Id, newNickname)
+ }
+
c.cache.SetUser(update.User.Id, update.User)
show, status, presenceType := c.userStatusToText(update.User.Status, update.User.Id)
go c.ProcessStatusUpdate(update.User.Id, status, show, gateway.SPType(presenceType))