Strip IRC colors sent to Matrix

This commit is contained in:
chotaire
2019-04-17 03:18:26 +02:00
parent 4b176ef0cc
commit fd79eac291

View File

@@ -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{