diff options
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r-- | telegram/handlers.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go index abc1f5d..cc6e635 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -226,6 +226,8 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) { }).Warn("New message from chat") c.ProcessIncomingMessage(chatId, update.Message, ignoredResource) + + c.updateLastMessageHash(update.Message.ChatId, update.Message.Id, update.Message.Content) }() } @@ -233,6 +235,8 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) { func (c *Client) updateMessageContent(update *client.UpdateMessageContent) { markupFunction := formatter.EntityToXEP0393 + defer c.updateLastMessageHash(update.ChatId, update.MessageId, update.NewContent) + c.SendMessageLock.Lock() c.SendMessageLock.Unlock() xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, update.ChatId, update.MessageId) @@ -250,7 +254,7 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) { return } - if update.NewContent.MessageContentType() == client.TypeMessageText { + if update.NewContent.MessageContentType() == client.TypeMessageText && c.hasLastMessageHashChanged(update.ChatId, update.MessageId, update.NewContent) { textContent := update.NewContent.(*client.MessageText) var editChar string if c.Session.AsciiArrows { |