aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-07-16 04:38:10 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-07-16 04:38:10 +0300
commite954c73bd2d881bc448b6bb2b3cb3a4ad37d0139 (patch)
treed7ca50fd61e8aecd81049667dd871acc9c874f7b /telegram/utils.go
parent959dc061ff30ba1cf5c699adc0f7d1d991d7afa5 (diff)
Do not ack with edited message to the XEP-0308 sender resource
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go33
1 files changed, 19 insertions, 14 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 9664857..9486349 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -891,7 +891,6 @@ 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) {
- var jids []string
var isPM bool
var err error
if gateway.MessageOutgoingPermission && c.Session.Carbons {
@@ -900,21 +899,13 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message, i
log.Errorf("Could not determine if chat is PM: %v", err)
}
}
+
isOutgoing := message.IsOutgoing
isCarbon := isPM && isOutgoing
- log.Warnf("isOutgoing: %v", isOutgoing)
- if isOutgoing {
- for resource := range c.resourcesRange() {
- if ignoredResource == "" || resource != ignoredResource {
- jids = append(jids, c.jid+"/"+resource)
- }
- }
- if len(jids) == 0 {
- log.Info("The only resource is ignored, aborting")
- return
- }
- } else {
- jids = []string{c.jid}
+ jids := c.getCarbonFullJids(isOutgoing, ignoredResource)
+ if len(jids) == 0 {
+ log.Info("The only resource is ignored, aborting")
+ return
}
var text, oob, auxText string
@@ -1379,3 +1370,17 @@ func (c *Client) popFromOutbox(xmppId string) string {
}
return resource
}
+
+func (c *Client) getCarbonFullJids(isOutgoing bool, ignoredResource string) []string {
+ var jids []string
+ if isOutgoing {
+ for resource := range c.resourcesRange() {
+ if ignoredResource == "" || resource != ignoredResource {
+ jids = append(jids, c.jid+"/"+resource)
+ }
+ }
+ } else {
+ jids = []string{c.jid}
+ }
+ return jids
+}