Strip IRC colors sent to Zulip

This commit is contained in:
chotaire
2019-04-17 03:37:06 +02:00
parent 5750aa2c62
commit d0b54d357f

View File

@@ -7,6 +7,7 @@ import (
"strings"
"sync"
"time"
"regexp"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -63,6 +64,10 @@ func (b *Bzulip) Send(msg config.Message) (string, error) {
return "", err
}
// Strip IRC colors sent to Zulip
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
msg.Text = re.ReplaceAllString(msg.Text, "")
// Upload a file if it exists
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {