diff options
author | Wim <wim@42.be> | 2016-11-13 23:50:12 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2016-11-13 23:50:12 +0100 |
commit | 69d6f4b2daa50484cd370b67b4d776c1ce1268f6 (patch) | |
tree | 7eb59579aba6ab4fadda448e82378ec9ef5e2eda | |
parent | f7e22983a5d1dafe4e024456918c8ffc9b34bace (diff) | |
download | matterbridge-msglm-69d6f4b2daa50484cd370b67b4d776c1ce1268f6.tar.gz matterbridge-msglm-69d6f4b2daa50484cd370b67b4d776c1ce1268f6.tar.bz2 matterbridge-msglm-69d6f4b2daa50484cd370b67b4d776c1ce1268f6.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 { |