Fix reply length for hrunicode messages
This commit is contained in:
parent
282a6fc21b
commit
67b8ad57f0
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
COMMIT := $(shell git rev-parse --short HEAD)
|
COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
|
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
|
||||||
VERSION := "v1.8.2"
|
VERSION := "v1.8.3"
|
||||||
MAKEOPTS := "-j4"
|
MAKEOPTS := "-j4"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
goxmpp "gosrc.io/xmpp"
|
goxmpp "gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "1.8.2"
|
var version string = "1.8.3"
|
||||||
var commit string
|
var commit string
|
||||||
|
|
||||||
var sm *goxmpp.StreamManager
|
var sm *goxmpp.StreamManager
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"dev.narayana.im/narayana/telegabber/telegram/cache"
|
"dev.narayana.im/narayana/telegabber/telegram/cache"
|
||||||
"dev.narayana.im/narayana/telegabber/telegram/formatter"
|
"dev.narayana.im/narayana/telegabber/telegram/formatter"
|
||||||
|
@ -42,7 +43,7 @@ var spaceRegex = regexp.MustCompile(`\s+`)
|
||||||
var replyRegex = regexp.MustCompile("\\A>>? ?([0-9]+)\\n")
|
var replyRegex = regexp.MustCompile("\\A>>? ?([0-9]+)\\n")
|
||||||
|
|
||||||
const newlineChar string = "\n"
|
const newlineChar string = "\n"
|
||||||
const messageHeaderSeparator string = " | "
|
const messageHeaderSeparator string = " | " // no hrunicode allowed here yet
|
||||||
|
|
||||||
// GetContactByUsername resolves username to user id retrieves user and chat information
|
// GetContactByUsername resolves username to user id retrieves user and chat information
|
||||||
func (c *Client) GetContactByUsername(username string) (*client.Chat, *client.User, error) {
|
func (c *Client) GetContactByUsername(username string) (*client.Chat, *client.User, error) {
|
||||||
|
@ -845,7 +846,7 @@ func (c *Client) contentToFile(content client.MessageContent) (*client.File, *cl
|
||||||
|
|
||||||
func (c *Client) countCharsInLines(lines *[]string) (count int) {
|
func (c *Client) countCharsInLines(lines *[]string) (count int) {
|
||||||
for _, line := range *lines {
|
for _, line := range *lines {
|
||||||
count += len(line)
|
count += utf8.RuneCountInString(line)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -895,7 +896,7 @@ func (c *Client) messageToPrefix(message *client.Message, previewString string,
|
||||||
}
|
}
|
||||||
replyLine := "reply: " + c.formatMessage(message.ChatId, message.ReplyToMessageId, true, replyMsg)
|
replyLine := "reply: " + c.formatMessage(message.ChatId, message.ReplyToMessageId, true, replyMsg)
|
||||||
prefix = append(prefix, replyLine)
|
prefix = append(prefix, replyLine)
|
||||||
replyEnd = replyStart + len(replyLine)
|
replyEnd = replyStart + utf8.RuneCountInString(replyLine)
|
||||||
if len(prefix) > 0 {
|
if len(prefix) > 0 {
|
||||||
replyEnd += len(messageHeaderSeparator)
|
replyEnd += len(messageHeaderSeparator)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue