summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-05-23 21:46:15 +0200
committerGitHub <noreply@github.com>2020-05-23 21:46:15 +0200
commitba0bfe70a8f07164e1341f4b094841acdad5c3a2 (patch)
tree1724d193854bc333b56cd585138ebe8a013dcbd8 /bridge
parent3c4a3e3f75bcab74539512eeab40cc88a9f849a2 (diff)
downloadmatterbridge-msglm-ba0bfe70a8f07164e1341f4b094841acdad5c3a2.tar.gz
matterbridge-msglm-ba0bfe70a8f07164e1341f4b094841acdad5c3a2.tar.bz2
matterbridge-msglm-ba0bfe70a8f07164e1341f4b094841acdad5c3a2.zip
Add StripMarkdown option (irc). (#1145)
Enable `StripMarkdown` to strip markdown for irc.
Diffstat (limited to 'bridge')
-rw-r--r--bridge/config/config.go1
-rw-r--r--bridge/irc/irc.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 031f5a81..59d7d4be 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -136,6 +136,7 @@ type Protocol struct {
SkipTLSVerify bool // IRC, mattermost
SkipVersionCheck bool // mattermost
StripNick bool // all protocols
+ StripMarkdown bool // irc
SyncTopic bool // slack
TengoModifyMessage string // general
Team string // mattermost, keybase
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index bae9aef0..5fc315a7 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -14,6 +14,7 @@ import (
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/bridge/helper"
"github.com/lrstanley/girc"
+ stripmd "github.com/writeas/go-strip-markdown"
// We need to import the 'data' package as an implicit dependency.
// See: https://godoc.org/github.com/paulrosania/go-charset/charset
@@ -156,6 +157,10 @@ func (b *Birc) Send(msg config.Message) (string, error) {
}
var msgLines []string
+ if b.GetBool("StripMarkdown") {
+ msg.Text = stripmd.Strip(msg.Text)
+ }
+
if b.GetBool("MessageSplit") {
msgLines = helper.GetSubLines(msg.Text, b.MessageLength)
} else {