diff options
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r-- | telegram/handlers.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go index 919c173..126d858 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -135,6 +135,12 @@ func (c *Client) updateHandler() { uhOh() } c.updateMessageSendFailed(typedUpdate) + case client.TypeUpdateChatTitle: + typedUpdate, ok := update.(*client.UpdateChatTitle) + if !ok { + uhOh() + } + c.updateChatTitle(typedUpdate) default: // log only handled types continue @@ -277,3 +283,14 @@ func (c *Client) updateMessageSendFailed(update *client.UpdateMessageSendFailed) c.cleanTempFile(file.Local.Path) } } + +// chat title changed +func (c *Client) updateChatTitle(update *client.UpdateChatTitle) { + gateway.SetNickname(c.jid, strconv.FormatInt(update.ChatId, 10), update.Title, c.xmpp) + + // set also the status (for group chats only) + _, user, _ := c.GetContactByID(update.ChatId, nil) + if user == nil { + c.ProcessStatusUpdate(update.ChatId, update.Title, "chat", gateway.SPImmed(true)) + } +} |