summaryrefslogtreecommitdiffstats
path: root/bridge/config
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-13 23:09:06 +0100
committerWim <wim@42.be>2016-11-13 23:09:06 +0100
commit497633867759601d658233257447b5b86aa1b01e (patch)
treebc732d5333ddcd0343e1c2d7fd0a025c23822196 /bridge/config
parent4fb0544b0e25bf6409811fc3e574bf45efea369d (diff)
parent99d130d1ed4c389a76d4fe7f5ea8fccb78bad444 (diff)
downloadmatterbridge-msglm-497633867759601d658233257447b5b86aa1b01e.tar.gz
matterbridge-msglm-497633867759601d658233257447b5b86aa1b01e.tar.bz2
matterbridge-msglm-497633867759601d658233257447b5b86aa1b01e.zip
Merge branch 'refactor'
Diffstat (limited to 'bridge/config')
-rw-r--r--bridge/config/config.go27
1 files changed, 10 insertions, 17 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 1575bff4..c577e340 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -9,13 +9,11 @@ import (
)
type Message struct {
- Text string
- Channel string
- Username string
- Origin string
- FullOrigin string
- Protocol string
- Avatar string
+ Text string
+ Channel string
+ Username string
+ Avatar string
+ Account string
}
type Protocol struct {
@@ -126,16 +124,11 @@ func OverrideCfgFromEnv(cfg *Config, protocol string, account string) {
func GetIconURL(msg *Message, cfg *Protocol) string {
iconURL := cfg.IconURL
+ info := strings.Split(msg.Account, ".")
+ protocol := info[0]
+ name := info[1]
iconURL = strings.Replace(iconURL, "{NICK}", msg.Username, -1)
- iconURL = strings.Replace(iconURL, "{BRIDGE}", msg.Origin, -1)
- iconURL = strings.Replace(iconURL, "{PROTOCOL}", msg.Protocol, -1)
+ iconURL = strings.Replace(iconURL, "{BRIDGE}", name, -1)
+ iconURL = strings.Replace(iconURL, "{PROTOCOL}", 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
-}