Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 6b140c3b96ec8bfcb4ad93d5f53f88f6a92de6ec Author: Wim <wim@42.be> Date: Sun Nov 20 23:33:41 2016 +0000 Add support for RemoteNickFormat in general configuration diff --git a/bridge/config/config.go b/bridge/config/config.go index 1958bf5..4b0a7ea 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -806 +807 @@ 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 f45f315..e36d1a4 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -1787 +17810 @@ 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 df73713..8aa5373 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -3716 +37119 @@ 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