summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/config/config.go1
-rw-r--r--bridge/telegram/handlers.go8
2 files changed, 9 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 5da535dc..105d568f 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -116,6 +116,7 @@ type Protocol struct {
Protocol string // all protocols
QuoteDisable bool // telegram
QuoteFormat string // telegram
+ QuoteLengthLimit int // telegram
RejoinDelay int // IRC
ReplaceMessages [][]string // all protocols
ReplaceNicks [][]string // all protocols
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go
index bbe12437..a74a3f8a 100644
--- a/bridge/telegram/handlers.go
+++ b/bridge/telegram/handlers.go
@@ -357,6 +357,14 @@ func (b *Btelegram) handleQuote(message, quoteNick, quoteMessage string) string
if format == "" {
format = "{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})"
}
+ quoteMessagelength := len(quoteMessage)
+ if b.GetInt("QuoteLengthLimit") != 0 && quoteMessagelength >= b.GetInt("QuoteLengthLimit") {
+ runes := []rune(quoteMessage)
+ quoteMessage = string(runes[0:b.GetInt("QuoteLengthLimit")])
+ if quoteMessagelength > b.GetInt("QuoteLengthLimit") {
+ quoteMessage += "..."
+ }
+ }
format = strings.Replace(format, "{MESSAGE}", message, -1)
format = strings.Replace(format, "{QUOTENICK}", quoteNick, -1)
format = strings.Replace(format, "{QUOTEMESSAGE}", quoteMessage, -1)