From fd79eac291930ec9fc16925a06dae4aa63749bbe Mon Sep 17 00:00:00 2001 From: chotaire Date: Wed, 17 Apr 2019 03:18:26 +0200 Subject: [PATCH] Strip IRC colors sent to Matrix --- bridge/matrix/matrix.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index f76c4ab8..e7232b7d 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -8,6 +8,7 @@ import ( "regexp" "strings" "sync" + "regexp" "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" @@ -74,6 +75,10 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) { channel := b.getRoomID(msg.Channel) b.Log.Debugf("Channel %s maps to channel id %s", msg.Channel, channel) + // Strip IRC colors sent to Matrix + re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`) + msg.Text = re.ReplaceAllString(msg.Text, "") + // Make a action /me of the message if msg.Event == config.EventUserAction { m := matrix.TextMessage{