5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 09:51:36 +00:00

Add support for RemoteNickFormat in general configuration

This commit is contained in:
Wim 2016-11-20 23:33:41 +01:00
parent e0e1e4be80
commit e1641b2c2e
3 changed files with 18 additions and 1 deletions

View File

@ -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
}

View File

@ -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)

View File

@ -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