aboutsummaryrefslogtreecommitdiff
path: root/telegram/handlers.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-01-31 17:29:45 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-01-31 17:29:45 +0300
commiteace19eef78a7b88d61888b1db87db3e4364e02c (patch)
treec5ef26a90f0c8df36c388a11b43c6bd580491d24 /telegram/handlers.go
parentfd0d7411c2f5e1e0368d3494318ce05195d0a56d (diff)
parentf56e6ac1870a946e2084edef0b496d645a826706 (diff)
Merge branch 'master' into adhoc
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r--telegram/handlers.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go
index dfdd3d5..425309e 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -244,6 +244,8 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
lock.Lock()
defer lock.Unlock()
+ c.updateLastMessageHash(update.Message.ChatId, update.Message.Id, update.Message.Content)
+
// ignore self outgoing messages
if update.Message.IsOutgoing &&
update.Message.SendingState != nil &&
@@ -256,8 +258,6 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
}).Warn("New message from chat")
c.ProcessIncomingMessage(chatId, update.Message)
-
- c.updateLastMessageHash(update.Message.ChatId, update.Message.Id, update.Message.Content)
}()
}
@@ -267,8 +267,14 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
defer c.updateLastMessageHash(update.ChatId, update.MessageId, update.NewContent)
+ log.Debugf("newContent: %#v", update.NewContent)
+
+ lock := c.getChatMessageLock(update.ChatId)
+ lock.Lock()
+ lock.Unlock()
c.SendMessageLock.Lock()
c.SendMessageLock.Unlock()
+
xmppId, xmppIdErr := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, update.ChatId, update.MessageId)
var ignoredResource string
if xmppIdErr == nil {
@@ -286,6 +292,8 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
if update.NewContent.MessageContentType() == client.TypeMessageText && c.hasLastMessageHashChanged(update.ChatId, update.MessageId, update.NewContent) {
textContent := update.NewContent.(*client.MessageText)
+ log.Debugf("textContent: %#v", textContent.Text)
+
var replaceId string
sId := strconv.FormatInt(update.MessageId, 10)
var isCarbon bool