summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-20 23:33:41 +0100
committerWim <wim@42.be>2016-11-20 23:33:41 +0100
commite1641b2c2e6b80402d642e94fb1df797c1816369 (patch)
treedbdf21c54607c36b786f608fbb8b13ef34116cb2
parente0e1e4be8018b256d86e2df9c3f84fc7881041c3 (diff)
downloadmatterbridge-msglm-e1641b2c2e6b80402d642e94fb1df797c1816369.tar.gz
matterbridge-msglm-e1641b2c2e6b80402d642e94fb1df797c1816369.tar.bz2
matterbridge-msglm-e1641b2c2e6b80402d642e94fb1df797c1816369.zip
Add support for RemoteNickFormat in general configuration
-rw-r--r--bridge/config/config.go1
-rw-r--r--gateway/gateway.go5
-rw-r--r--matterbridge.toml.sample13
3 files changed, 18 insertions, 1 deletions
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