summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn <7192933+qtaf@users.noreply.github.com>2018-07-11 16:50:49 -0400
committerWim <wim@42.be>2018-07-11 22:50:49 +0200
commit2d2d185200278ff9453c69be60cff13e1bec6e2c (patch)
tree7d489b436aafc285426f53d264cf9805ee9c8db0
parentcb7278eb503498da4e1bcaf24b330d696832e57b (diff)
downloadmatterbridge-msglm-2d2d185200278ff9453c69be60cff13e1bec6e2c.tar.gz
matterbridge-msglm-2d2d185200278ff9453c69be60cff13e1bec6e2c.tar.bz2
matterbridge-msglm-2d2d185200278ff9453c69be60cff13e1bec6e2c.zip
Stop numbers being stripped after non-color control codes (irc) (#465)
Currently numbers are stripped not just after the color control code (\x03) but also after other formatting such as bold (\x02) and italic (\x1D), which is both unnecessary and leads to missing text from irc. This fixes that by only stripping numbers after the color control code.
-rw-r--r--bridge/irc/irc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index fe1e0d3b..5b1d74eb 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -397,7 +397,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
rmsg.Text += event.StripAction()
// strip IRC colors
- re := regexp.MustCompile(`[[:cntrl:]](?:\d{1,2}(?:,\d{1,2})?)?`)
+ re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
rmsg.Text = re.ReplaceAllString(rmsg.Text, "")
// start detecting the charset