From e1641b2c2e6b80402d642e94fb1df797c1816369 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 20 Nov 2016 23:33:41 +0100 Subject: Add support for RemoteNickFormat in general configuration --- bridge/config/config.go | 1 + gateway/gateway.go | 5 ++++- matterbridge.toml.sample | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/bridge/config/config.go b/bridge/config/config.go index 1958bf57..4b0a7ead 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -80,6 +80,7 @@ type Config struct { Xmpp map[string]Protocol Discord map[string]Protocol Telegram map[string]Protocol + General Protocol Gateway []Gateway SameChannelGateway []SameChannelGateway } diff --git a/gateway/gateway.go b/gateway/gateway.go index f45f315e..e36d1a4d 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -178,7 +178,10 @@ func (gw *Gateway) modifyMessage(msg *config.Message, dest *bridge.Bridge) { func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) { br := gw.Bridges[msg.Account] - nick := dest.Config.RemoteNickFormat + nick := gw.Config.General.RemoteNickFormat + if nick == "" { + nick = dest.Config.RemoteNickFormat + } nick = strings.Replace(nick, "{NICK}", msg.Username, -1) nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1) nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1) diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index df73713b..8aa53737 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -371,6 +371,19 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> " #OPTIONAL (default false) ShowJoinPart=false +################################################################### +#General configuration +################################################################### +#Settings here override specific settings for each protocol +[general] +#RemoteNickFormat defines how remote users appear on this bridge +#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username. +#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge +#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge +#OPTIONAL (default empty) +RemoteNickFormat="[{PROTOCOL}] <{NICK}> " + + ################################################################### #Gateway configuration -- cgit v1.2.3