From d44598a900a9c28445ec55d4572b27c7146bcd83 Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 14 May 2020 00:37:41 +0200 Subject: Add an option to disable sending HTML to matrix. Fixes #1022 (#1135) --- bridge/config/config.go | 1 + bridge/matrix/matrix.go | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index dfb71eec..031f5a81 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -84,6 +84,7 @@ type Protocol struct { DisableWebPagePreview bool // telegram EditSuffix string // mattermost, slack, discord, telegram, gitter EditDisable bool // mattermost, slack, discord, telegram, gitter + HTMLDisable bool // matrix IconURL string // mattermost, slack IgnoreFailureOnStart bool // general IgnoreNicks string // all protocols diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index 78779c87..6521fe86 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -124,6 +124,14 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) { return resp.EventID, err } + if b.GetBool("HTMLDisable") { + resp, err := b.mc.SendText(channel, msg.Username+msg.Text) + if err != nil { + return "", err + } + return resp.EventID, err + } + username := html.EscapeString(msg.Username) // check if we have a . if we have, we don't escape HTML. #696 if b.htmlTag.MatchString(msg.Username) { -- cgit v1.2.3