Strip IRC colors sent to XMPP

This commit is contained in:
chotaire
2019-04-17 03:36:04 +02:00
parent ed5635f9d2
commit 5750aa2c62

View File

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"strings"
"time"
"regexp"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -82,6 +83,10 @@ func (b *Bxmpp) Send(msg config.Message) (string, error) {
}
b.Log.Debugf("=> Receiving %#v", msg)
// Strip IRC colors sent to XMPP
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
msg.Text = re.ReplaceAllString(msg.Text, "")
// Upload a file (in xmpp case send the upload URL because xmpp has no native upload support)
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {