diff options
author | Wim <wim@42.be> | 2017-02-17 22:08:30 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-02-17 22:08:30 +0100 |
commit | 62b165c0b4052f96ab89c358301bf246d239eba7 (patch) | |
tree | 3c8227f1c7f3b2b83bd0ec17005e0110b34746ab /gateway/gateway.go | |
parent | dc3723210076d7f7fecdfbf98b5de2f4540900ea (diff) | |
download | matterbridge-msglm-62b165c0b4052f96ab89c358301bf246d239eba7.tar.gz matterbridge-msglm-62b165c0b4052f96ab89c358301bf246d239eba7.tar.bz2 matterbridge-msglm-62b165c0b4052f96ab89c358301bf246d239eba7.zip |
Refactor samechannelgateway
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r-- | gateway/gateway.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go index 95bf902a..f965f8a6 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -12,14 +12,14 @@ import ( type Gateway struct { *config.Config - MyConfig *config.Gateway - //Bridges []*bridge.Bridge - Bridges map[string]*bridge.Bridge - ChannelsOut map[string][]string - ChannelsIn map[string][]string - ChannelOptions map[string]config.ChannelOptions - Name string - Message chan config.Message + MyConfig *config.Gateway + Bridges map[string]*bridge.Bridge + ChannelsOut map[string][]string + ChannelsIn map[string][]string + ChannelOptions map[string]config.ChannelOptions + Name string + Message chan config.Message + DestChannelFunc func(msg *config.Message, dest string) []string } func New(cfg *config.Config, gateway *config.Gateway) *Gateway { @@ -29,6 +29,7 @@ func New(cfg *config.Config, gateway *config.Gateway) *Gateway { gw.MyConfig = gateway gw.Message = make(chan config.Message) gw.Bridges = make(map[string]*bridge.Bridge) + gw.DestChannelFunc = gw.getDestChannel return gw } @@ -151,7 +152,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) { return } originchannel := msg.Channel - channels := gw.getDestChannel(&msg, dest.Account) + channels := gw.DestChannelFunc(&msg, dest.Account) for _, channel := range channels { // do not send the message to the bridge we come from if also the channel is the same if msg.Account == dest.Account && channel == originchannel { |