diff options
author | Wim <wim@42.be> | 2016-11-13 23:50:12 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2016-11-13 23:50:25 +0100 |
commit | 2d1316e32cfabe28719d3007324e8b2956a0493f (patch) | |
tree | 84803b689355eed4f7d150761534671bac9279f9 | |
parent | 11def2edc07d58fe31f31af445fde3bbbaf68f36 (diff) | |
download | matterbridge-msglm-2d1316e32cfabe28719d3007324e8b2956a0493f.tar.gz matterbridge-msglm-2d1316e32cfabe28719d3007324e8b2956a0493f.tar.bz2 matterbridge-msglm-2d1316e32cfabe28719d3007324e8b2956a0493f.zip |
Remove double username modify. Fixes #77
-rw-r--r-- | gateway/samechannel/samechannel.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/gateway/samechannel/samechannel.go b/gateway/samechannel/samechannel.go index 2240ee84..60d0958d 100644 --- a/gateway/samechannel/samechannel.go +++ b/gateway/samechannel/samechannel.go @@ -4,7 +4,6 @@ import ( "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" log "github.com/Sirupsen/logrus" - "strings" ) type SameChannelGateway struct { @@ -62,7 +61,6 @@ func (gw *SameChannelGateway) handleMessage(msg config.Message, dest bridge.Brid if msg.FullOrigin == dest.FullOrigin() { return } - gw.modifyMessage(&msg, dest) log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.FullOrigin, msg.Channel, dest.FullOrigin(), msg.Channel) err := dest.Send(msg) if err != nil { @@ -70,29 +68,6 @@ func (gw *SameChannelGateway) handleMessage(msg config.Message, dest bridge.Brid } } -func setNickFormat(msg *config.Message, format string) { - if format == "" { - msg.Username = msg.Protocol + "." + msg.Origin + "-" + msg.Username + ": " - return - } - msg.Username = strings.Replace(format, "{NICK}", msg.Username, -1) - msg.Username = strings.Replace(msg.Username, "{BRIDGE}", msg.Origin, -1) - msg.Username = strings.Replace(msg.Username, "{PROTOCOL}", msg.Protocol, -1) -} - -func (gw *SameChannelGateway) modifyMessage(msg *config.Message, dest bridge.Bridge) { - switch dest.Protocol() { - case "irc": - setNickFormat(msg, gw.Config.IRC[dest.Origin()].RemoteNickFormat) - case "mattermost": - setNickFormat(msg, gw.Config.Mattermost[dest.Origin()].RemoteNickFormat) - case "slack": - setNickFormat(msg, gw.Config.Slack[dest.Origin()].RemoteNickFormat) - case "discord": - setNickFormat(msg, gw.Config.Discord[dest.Origin()].RemoteNickFormat) - } -} - func (gw *SameChannelGateway) validChannel(channel string) bool { for _, c := range gw.Channels { if c == channel { |