diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-08 07:54:24 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-08 07:54:24 +0300 |
commit | 64515e2c666067953e3a9680b4f0db84f3838498 (patch) | |
tree | ca8c841a2ca45458a03b3f966586c3b44c8ee964 | |
parent | 9377d7a15538a6c0af97937806ecd55eb112beb3 (diff) |
Fix replies to messages with non-ASCII charactersv1.7.6
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | telegabber.go | 2 | ||||
-rw-r--r-- | xmpp/handlers.go | 7 |
3 files changed, 8 insertions, 3 deletions
@@ -2,7 +2,7 @@ COMMIT := $(shell git rev-parse --short HEAD) TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1" -VERSION := "v1.7.5" +VERSION := "v1.7.6" MAKEOPTS := "-j4" all: diff --git a/telegabber.go b/telegabber.go index 37d5890..3802764 100644 --- a/telegabber.go +++ b/telegabber.go @@ -15,7 +15,7 @@ import ( goxmpp "gosrc.io/xmpp" ) -var version string = "1.7.5" +var version string = "1.7.6" var commit string var sm *goxmpp.StreamManager diff --git a/xmpp/handlers.go b/xmpp/handlers.go index e85dfc9..36f9cf9 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -149,7 +149,12 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { "end": body.End, }).Warn(errors.Wrap(err, "Failed to parse fallback end!")) } - text = text[:start] + text[end:] + + fullRunes := []rune(text) + cutRunes := make([]rune, 0, len(text)-int(end-start)) + cutRunes = append(cutRunes, fullRunes[:start]...) + cutRunes = append(cutRunes, fullRunes[end:]...) + text = string(cutRunes) } } var replaceId int64 |