summaryrefslogtreecommitdiffstats
path: root/gateway/gateway.go
diff options
context:
space:
mode:
authorDuco van Amstel <duco.vanamstel@gmail.com>2018-10-07 14:22:15 +0100
committerWim <wim@42.be>2018-10-07 15:22:15 +0200
commit69646a160d8597944c307334901f0acfd32582c5 (patch)
treed76d80bb16bd83a07c1015e7038ab4b3c64e953d /gateway/gateway.go
parent54adb0509e8f22bdfa70a88834c6499e4078648b (diff)
downloadmatterbridge-msglm-69646a160d8597944c307334901f0acfd32582c5.tar.gz
matterbridge-msglm-69646a160d8597944c307334901f0acfd32582c5.tar.bz2
matterbridge-msglm-69646a160d8597944c307334901f0acfd32582c5.zip
Add Gateway's name to RemoteNickFormat (#501)
In order to support extra use cases we should add the `{GATEWAY}` tag to the `RemoteNickFormat` string which would be replaced by the value of the `name=` field from a gateway's configuration. This is _very_ useful when you are forwarding, for example, multiple channels from one chat to a single channel on another one (one-way). It will help you identify the source channel of a message on the target chat.
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r--gateway/gateway.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 6529393f..a33a9a97 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -374,6 +374,7 @@ func (gw *Gateway) modifyUsername(msg config.Message, dest *bridge.Bridge) strin
nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)
nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1)
+ nick = strings.Replace(nick, "{GATEWAY}", gw.Name, -1)
nick = strings.Replace(nick, "{LABEL}", br.GetString("Label"), -1)
nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
return nick