summaryrefslogtreecommitdiffstats
path: root/bridge/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/config/config.go')
-rw-r--r--bridge/config/config.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 89222894..32c8c74f 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -122,3 +122,19 @@ func OverrideCfgFromEnv(cfg *Config, protocol string, account string) {
}
}
}
+
+func GetIconURL(msg *Message, cfg *Protocol) string {
+ iconURL := cfg.IconURL
+ iconURL = strings.Replace(iconURL, "{NICK}", msg.Username, -1)
+ iconURL = strings.Replace(iconURL, "{BRIDGE}", msg.Origin, -1)
+ iconURL = strings.Replace(iconURL, "{PROTOCOL}", msg.Protocol, -1)
+ return iconURL
+}
+
+func GetNick(msg *Message, cfg *Protocol) string {
+ nick := cfg.RemoteNickFormat
+ nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
+ nick = strings.Replace(nick, "{BRIDGE}", msg.Origin, -1)
+ nick = strings.Replace(nick, "{PROTOCOL}", msg.Protocol, -1)
+ return nick
+}