summaryrefslogtreecommitdiffstats
path: root/bridge/config/config.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-05 01:11:28 +0100
committerWim <wim@42.be>2016-11-05 01:11:51 +0100
commit2dbe0eb55729620ffdfdb7e4f10003564d79c7e1 (patch)
tree65e5309a42c1cee478b5b0c8448c36d819c9d41a /bridge/config/config.go
parent50a0df427927b60724d8e6e00ba06822e0aa7308 (diff)
downloadmatterbridge-msglm-2dbe0eb55729620ffdfdb7e4f10003564d79c7e1.tar.gz
matterbridge-msglm-2dbe0eb55729620ffdfdb7e4f10003564d79c7e1.tar.bz2
matterbridge-msglm-2dbe0eb55729620ffdfdb7e4f10003564d79c7e1.zip
Add support for dynamic IconURL (slack). Closes #43
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
+}