diff options
author | Wim <wim@42.be> | 2016-09-21 00:33:40 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-09-21 00:33:40 +0200 |
commit | 1d240140c90fe46933770fb2f7ddf4b6a5be0e8e (patch) | |
tree | 3c9f2378bfca5378115bf7e74e18a5d4b67be87f | |
parent | 272eef544f7c4c6951b3dc6539120168dcd0996d (diff) | |
download | matterbridge-msglm-1d240140c90fe46933770fb2f7ddf4b6a5be0e8e.tar.gz matterbridge-msglm-1d240140c90fe46933770fb2f7ddf4b6a5be0e8e.tar.bz2 matterbridge-msglm-1d240140c90fe46933770fb2f7ddf4b6a5be0e8e.zip |
Strip IRC colors. Closes #33
-rw-r--r-- | bridge/irc/irc.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 1055808a..c8cb58f6 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -6,6 +6,7 @@ import ( log "github.com/Sirupsen/logrus" ircm "github.com/sorcix/irc" "github.com/thoj/go-ircevent" + "regexp" "sort" "strconv" "strings" @@ -158,6 +159,9 @@ func (b *Birc) handlePrivMsg(event *irc.Event) { msg = event.Nick + " " } msg += event.Message() + // strip IRC colors + re := regexp.MustCompile(`[[:cntrl:]]\d+,\d`) + msg = re.ReplaceAllString(msg, "") flog.Debugf("Sending message from %s on %s to gateway", event.Arguments[0], b.FullOrigin()) b.Remote <- config.Message{Username: event.Nick, Text: msg, Channel: event.Arguments[0], Origin: b.origin, Protocol: b.protocol, FullOrigin: b.FullOrigin()} } |