summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-05-14 00:37:41 +0200
committerGitHub <noreply@github.com>2020-05-14 00:37:41 +0200
commitd44598a900a9c28445ec55d4572b27c7146bcd83 (patch)
tree451dbf999f6a6514825e866f69b053f636a05997
parentc9cfa59f5453add42fb3dd9cc29bdc0d692b2077 (diff)
downloadmatterbridge-msglm-d44598a900a9c28445ec55d4572b27c7146bcd83.tar.gz
matterbridge-msglm-d44598a900a9c28445ec55d4572b27c7146bcd83.tar.bz2
matterbridge-msglm-d44598a900a9c28445ec55d4572b27c7146bcd83.zip
Add an option to disable sending HTML to matrix. Fixes #1022 (#1135)
-rw-r--r--bridge/config/config.go1
-rw-r--r--bridge/matrix/matrix.go8
-rw-r--r--matterbridge.toml.sample5
3 files changed, 14 insertions, 0 deletions
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 </tag>. if we have, we don't escape HTML. #696
if b.htmlTag.MatchString(msg.Username) {
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index 4082b6dc..e0942c65 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -1209,6 +1209,11 @@ Password="yourpass"
#OPTIONAL (default false)
NoHomeServerSuffix=false
+#Whether to disable sending of HTML content to matrix
+#See https://github.com/42wim/matterbridge/issues/1022
+#OPTIONAL (default false)
+HTMLDisable=false
+
## RELOADABLE SETTINGS
## Settings below can be reloaded by editing the file