Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 2192b272acb421e05381494615c36ec0a1fc63ba Author: Wim <wim@42.be> Date: Thu Feb 25 23:28:54 2021 +0000 Check rune length instead of bytes (telegram). Fixes #1409 (#1412) diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index 48cfd31..dbbc36e 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -18113 +18115 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {  // sends a EVENT_AVATAR_DOWNLOAD message to the gateway if successful.  // logs an error message if it fails  func (b *Btelegram) handleDownloadAvatar(userid int, channel string) { - rmsg := config.Message{Username: "system", - Text: "avatar", - Channel: channel, - Account: b.Account, - UserID: strconv.Itoa(userid), - Event: config.EventAvatarDownload, - Extra: make(map[string][]interface{})} + rmsg := config.Message{ + Username: "system", + Text: "avatar", + Channel: channel, + Account: b.Account, + UserID: strconv.Itoa(userid), + Event: config.EventAvatarDownload, + Extra: make(map[string][]interface{}), + }     if _, ok := b.avatarMap[strconv.Itoa(userid)]; !ok {   photos, err := b.c.GetUserProfilePhotos(tgbotapi.UserProfilePhotosConfig{UserID: userid, Limit: 1}) @@ -4137 +4157 @@ func (b *Btelegram) handleQuote(message, quoteNick, quoteMessage string) string   if format == "" {   format = "{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})"   } - quoteMessagelength := len(quoteMessage) + quoteMessagelength := len([]rune(quoteMessage))   if b.GetInt("QuoteLengthLimit") != 0 && quoteMessagelength >= b.GetInt("QuoteLengthLimit") {   runes := []rune(quoteMessage)   quoteMessage = string(runes[0:b.GetInt("QuoteLengthLimit")])