diff options
author | Wim <wim@42.be> | 2017-06-15 00:40:23 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-06-15 00:40:23 +0200 |
commit | 3bc219167adab683d0ae6f2e960ba7fd0aed70e9 (patch) | |
tree | 6723f5423c79386ba54731ff42560fd0438bf1ff | |
parent | 8a55c97b4e2c49e0bb762184f6a546ffbb891e77 (diff) | |
download | matterbridge-msglm-3bc219167adab683d0ae6f2e960ba7fd0aed70e9.tar.gz matterbridge-msglm-3bc219167adab683d0ae6f2e960ba7fd0aed70e9.tar.bz2 matterbridge-msglm-3bc219167adab683d0ae6f2e960ba7fd0aed70e9.zip |
Remove need for channel when using api. Closes #195
-rw-r--r-- | gateway/gateway.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go index 881e0ac9..2fa5a0bb 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -139,6 +139,9 @@ RECONNECT: func (gw *Gateway) mapChannels() error { for _, br := range append(gw.MyConfig.Out, gw.MyConfig.InOut...) { + if isApi(br.Account) { + br.Channel = "api" + } ID := br.Channel + br.Account _, ok := gw.Channels[ID] if !ok { @@ -153,6 +156,9 @@ func (gw *Gateway) mapChannels() error { } for _, br := range append(gw.MyConfig.In, gw.MyConfig.InOut...) { + if isApi(br.Account) { + br.Channel = "api" + } ID := br.Channel + br.Account _, ok := gw.Channels[ID] if !ok { @@ -298,3 +304,10 @@ func (gw *Gateway) validGatewayDest(msg *config.Message, channel *config.Channel } return false } + +func isApi(account string) bool { + if strings.HasPrefix(account, "api.") { + return true + } + return false +} |