commit 0fca2f8ff6aeac703ae1d32333a19143c13887fb
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Sat May 12 00:02:43 2018 +0000
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 0b92783..1627adc 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -626 +627 @@ type Protocol struct {
BindAddress string // mattermost, slack // DEPRECATED
Buffer int // api
Charset string // irc
+ ColorNicks bool // only irc for now
Debug bool // general
DebugLevel int // only for irc now
EditSuffix string // mattermost, slack, discord, telegram, gitter
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index 1e26b77..cb0a6fe 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -126 +127 @@ import (
"github.com/paulrosania/go-charset/charset"
_ "github.com/paulrosania/go-charset/data"
"github.com/saintfish/chardet"
+ "hash/crc32"
"io"
"io/ioutil"
"net"
@@ -24611 +24716 @@ func (b *Birc) doSend() {
throttle := time.NewTicker(rate)
for msg := range b.Local {
<-throttle.C
+ username := msg.Username
+ if b.GetBool("Colornicks") {
+ checksum := crc32.ChecksumIEEE([]byte(msg.Username))
+ username = fmt.Sprintf("\x03%d%s\x03", checksum%0x10, msg.Username)
+ }
if msg.Event == config.EVENT_USER_ACTION {
- b.i.Cmd.Action(msg.Channel, msg.Username+msg.Text)
+ b.i.Cmd.Action(msg.Channel, username+msg.Text)
} else {
b.Log.Debugf("Sending to channel %s", msg.Channel)
- b.i.Cmd.Message(msg.Channel, msg.Username+msg.Text)
+ b.i.Cmd.Message(msg.Channel, username+msg.Text)
}
}
}
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index e2558cb..bf9e147 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -926 +9210 @@ MessageSplit=false
#OPTIONAL (default 0)
RejoinDelay=0
+#ColorNicks will show each nickname in a different color.
+#Only works in IRC right now.
+ColorNicks=false
+
#Nicks you want to ignore.
#Messages from those users will not be sent to other bridges.
#OPTIONAL