From e57f3a7e6c9435cba74109fffd402216fcb80fe6 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 17 Apr 2018 23:26:41 +0200 Subject: Add QuoteDisable option (telegram). Closes #399 --- bridge/config/config.go | 1 + bridge/telegram/telegram.go | 11 ++++++++++- matterbridge.toml.sample | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bridge/config/config.go b/bridge/config/config.go index 831ea575..0a8bbc1b 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -92,6 +92,7 @@ type Protocol struct { Password string // IRC,mattermost,XMPP,matrix PrefixMessagesWithNick bool // mattemost, slack Protocol string // all protocols + QuoteDisable bool // telegram RejoinDelay int // IRC ReplaceMessages [][]string // all protocols ReplaceNicks [][]string // all protocols diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 7298c2d6..d2f229f8 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -221,7 +221,16 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { if usernameReply == "" { usernameReply = "unknown" } - rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + message.ReplyToMessage.Text + ")" + if !b.GetBool("QuoteDisable") { + rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + // remove empty lines + for _, m := range strings.Split(message.ReplyToMessage.Text, "\n") { + if m != "" { + rmsg.Text = rmsg.Text + m + } + } + rmsg.Text = rmsg.Text + ")" + } } if rmsg.Text != "" || len(rmsg.Extra) > 0 { diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 9646f053..91a87c47 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -787,6 +787,10 @@ UseFirstName=false #OPTIONAL (default false) UseInsecureURL=false +#Disable quoted/reply messages +#OPTIONAL (default false) +QuoteDisable=false + #Disable sending of edits to other bridges #OPTIONAL (default false) EditDisable=false -- cgit v1.2.3