diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-01-27 14:13:45 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-01-27 14:13:45 +0300 |
commit | 599cf16cdbb8567cf2ab1ce42aee5f493884de96 (patch) | |
tree | bc9be25328223d6ce5b3c3d3868496dd0ccdc75e /xmpp/handlers.go | |
parent | 81fc3ea3707cdf73b846ab55b2ecc5b8f68ccd21 (diff) |
Request and send to Telegram XEP-0333 displayed markers by "receipts" option
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r-- | xmpp/handlers.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 541eb63..9caf886 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -254,6 +254,30 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { gateway.MessageOutgoingPermissionVersion = 2 } } + + var displayed stanza.MarkDisplayed + msg.Get(&displayed) + if displayed.ID != "" { + log.Debugf("displayed: %#v", displayed) + + bare, _, ok := gateway.SplitJID(msg.From) + if !ok { + return + } + session, ok := sessions[bare] + if !ok { + return + } + toID, ok := toToID(msg.To) + if !ok { + return + } + msgId, err := strconv.ParseInt(displayed.ID, 10, 64) + if err == nil { + session.MarkAsRead(toID, msgId) + } + return + } } if msg.Type == "error" { |