5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-24 20:11:36 +00:00
matterbridge/gateway/samechannel/samechannel.go

29 lines
730 B
Go
Raw Normal View History

package samechannel
2016-09-30 21:19:47 +00:00
import (
"github.com/42wim/matterbridge/bridge/config"
)
type SameChannelGateway struct {
config.Config
2016-09-30 21:19:47 +00:00
}
func New(cfg config.Config) *SameChannelGateway {
return &SameChannelGateway{Config: cfg}
2016-09-30 21:19:47 +00:00
}
func (sgw *SameChannelGateway) GetConfig() []config.Gateway {
var gwconfigs []config.Gateway
cfg := sgw.Config
for _, gw := range cfg.BridgeValues().SameChannelGateway {
gwconfig := config.Gateway{Name: gw.Name, Enable: gw.Enable}
for _, account := range gw.Accounts {
for _, channel := range gw.Channels {
gwconfig.InOut = append(gwconfig.InOut, config.Bridge{Account: account, Channel: channel, SameChannel: true})
}
2016-09-30 21:19:47 +00:00
}
gwconfigs = append(gwconfigs, gwconfig)
2016-09-30 21:19:47 +00:00
}
return gwconfigs
}