From 1e7e761c6ce7bda3850ed23d0e64d884a28f60a7 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Tue, 3 Oct 2023 18:56:37 -0400 Subject: Reflect name change of Telegram user in all MUCs --- telegram/handlers.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'telegram/handlers.go') 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)) -- cgit v1.2.3