mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-28 13:42:01 -08:00
Remove need for channel when using api. Closes #195
This commit is contained in:
parent
8a55c97b4e
commit
3bc219167a
@ -139,6 +139,9 @@ RECONNECT:
|
|||||||
|
|
||||||
func (gw *Gateway) mapChannels() error {
|
func (gw *Gateway) mapChannels() error {
|
||||||
for _, br := range append(gw.MyConfig.Out, gw.MyConfig.InOut...) {
|
for _, br := range append(gw.MyConfig.Out, gw.MyConfig.InOut...) {
|
||||||
|
if isApi(br.Account) {
|
||||||
|
br.Channel = "api"
|
||||||
|
}
|
||||||
ID := br.Channel + br.Account
|
ID := br.Channel + br.Account
|
||||||
_, ok := gw.Channels[ID]
|
_, ok := gw.Channels[ID]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -153,6 +156,9 @@ func (gw *Gateway) mapChannels() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, br := range append(gw.MyConfig.In, gw.MyConfig.InOut...) {
|
for _, br := range append(gw.MyConfig.In, gw.MyConfig.InOut...) {
|
||||||
|
if isApi(br.Account) {
|
||||||
|
br.Channel = "api"
|
||||||
|
}
|
||||||
ID := br.Channel + br.Account
|
ID := br.Channel + br.Account
|
||||||
_, ok := gw.Channels[ID]
|
_, ok := gw.Channels[ID]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -298,3 +304,10 @@ func (gw *Gateway) validGatewayDest(msg *config.Message, channel *config.Channel
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isApi(account string) bool {
|
||||||
|
if strings.HasPrefix(account, "api.") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user