aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--telegabber.go2
-rw-r--r--telegram/commands.go2
-rw-r--r--telegram/handlers.go19
-rw-r--r--telegram/utils.go11
-rw-r--r--xmpp/handlers.go1
6 files changed, 14 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 2eb17ac..6732740 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
COMMIT := $(shell git rev-parse --short HEAD)
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
-VERSION := "v1.7.2"
+VERSION := "v1.7.3"
MAKEOPTS := "-j4"
all:
diff --git a/telegabber.go b/telegabber.go
index 9ce070f..3d7d2ea 100644
--- a/telegabber.go
+++ b/telegabber.go
@@ -15,7 +15,7 @@ import (
goxmpp "gosrc.io/xmpp"
)
-var version string = "1.7.2"
+var version string = "1.7.3"
var commit string
var sm *goxmpp.StreamManager
diff --git a/telegram/commands.go b/telegram/commands.go
index e164ce1..206e049 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -658,7 +658,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
}
if messages != nil && messages.Messages != nil {
for _, message := range messages.Messages {
- c.ProcessIncomingMessage(targetChatId, message, "")
+ c.ProcessIncomingMessage(targetChatId, message)
}
}
// print vCard
diff --git a/telegram/handlers.go b/telegram/handlers.go
index cedea63..0d1cda9 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -205,27 +205,24 @@ func (c *Client) updateChatLastMessage(update *client.UpdateChatLastMessage) {
func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
chatId := update.Message.ChatId
- c.SendMessageLock.Lock()
- c.SendMessageLock.Unlock()
- xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, chatId, update.Message.Id)
- var ignoredResource string
- if err == nil {
- ignoredResource = c.popFromOutbox(xmppId)
- } else {
- log.Infof("Couldn't retrieve XMPP message ids for %v, an echo may happen", update.Message.Id)
- }
-
// guarantee sequential message delivering per chat
lock := c.getChatMessageLock(chatId)
go func() {
lock.Lock()
defer lock.Unlock()
+ // ignore self outgoing messages
+ if update.Message.IsOutgoing &&
+ update.Message.SendingState != nil &&
+ update.Message.SendingState.MessageSendingStateType() == client.TypeMessageSendingStatePending {
+ return
+ }
+
log.WithFields(log.Fields{
"chat_id": chatId,
}).Warn("New message from chat")
- c.ProcessIncomingMessage(chatId, update.Message, ignoredResource)
+ c.ProcessIncomingMessage(chatId, update.Message)
c.updateLastMessageHash(update.Message.ChatId, update.Message.Id, update.Message.Content)
}()
diff --git a/telegram/utils.go b/telegram/utils.go
index cd25c22..62ce945 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -911,7 +911,7 @@ func (c *Client) ensureDownloadFile(file *client.File) *client.File {
}
// ProcessIncomingMessage transfers a message to XMPP side and marks it as read on Telegram side
-func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message, ignoredResource string) {
+func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
var isPM bool
var err error
if gateway.MessageOutgoingPermission && c.Session.Carbons {
@@ -921,13 +921,8 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message, i
}
}
- isOutgoing := message.IsOutgoing
- isCarbon := isPM && isOutgoing
- jids := c.getCarbonFullJids(isOutgoing, ignoredResource)
- if len(jids) == 0 {
- log.Info("The only resource is ignored, aborting")
- return
- }
+ isCarbon := isPM && message.IsOutgoing
+ jids := c.getCarbonFullJids(isCarbon, "")
var text, oob, auxText string
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index fd1afad..4e3354e 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -183,7 +183,6 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
if err != nil {
log.Errorf("Failed to save ids %v/%v %v", toID, tgMessageId, msg.Id)
}
- session.AddToOutbox(msg.Id, resource)
}
} else {
/*