summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuval Langer <yuval.langer@gmail.com>2018-05-29 23:52:01 +0300
committerWim <wim@42.be>2018-05-29 22:52:01 +0200
commit6576409d60bdf24fcac8299cad78043ecac261b5 (patch)
treea4bd8f7c1c8122a9888ff425f6f1bd42a4e4fd07
parent045cb2058cde1cbedeb5c1f0889f1d83ca024213 (diff)
downloadmatterbridge-msglm-6576409d60bdf24fcac8299cad78043ecac261b5.tar.gz
matterbridge-msglm-6576409d60bdf24fcac8299cad78043ecac261b5.tar.bz2
matterbridge-msglm-6576409d60bdf24fcac8299cad78043ecac261b5.zip
Prevent white or black color codes (irc) (#434)
-rw-r--r--bridge/irc/irc.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index 9947710f..4919c85d 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -250,7 +250,8 @@ func (b *Birc) doSend() {
username := msg.Username
if b.GetBool("Colornicks") {
checksum := crc32.ChecksumIEEE([]byte(msg.Username))
- username = fmt.Sprintf("\x03%02d%s\x0F", checksum%0x10, msg.Username)
+ colorCode := checksum%14 + 2 // quick fix - prevent white or black color codes
+ username = fmt.Sprintf("\x03%02d%s\x0F", colorCode, msg.Username)
}
if msg.Event == config.EVENT_USER_ACTION {
b.i.Cmd.Action(msg.Channel, username+msg.Text)