Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 6ef5fd2a970b8d61bf814eefedecc7df60197642 Author: Wim <wim@42.be> Date: Sun Jan 21 12:21:55 2018 +0000 Obey the Gateway value from the json (api). Closes #344 diff --git a/gateway/gateway.go b/gateway/gateway.go index 89ea80a..a316c34 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -1196 +11912 @@ func (gw *Gateway) mapChannels() error {    func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []config.ChannelInfo {   var channels []config.ChannelInfo + + // for messages received from the api check that the gateway is the specified one + if msg.Protocol == "api" && gw.Name != msg.Gateway { + return channels + } +   // if source channel is in only, do nothing   for _, channel := range gw.Channels {   // lookup the channel from the message @@ -3217 +32711 @@ func (gw *Gateway) modifyMessage(msg *config.Message) {   }   msg.Text = re.ReplaceAllString(msg.Text, replace)   } - msg.Gateway = gw.Name + + // messages from api have Gateway specified, don't overwrite + if msg.Protocol != "api" { + msg.Gateway = gw.Name + }  }    func (gw *Gateway) handleFiles(msg *config.Message) {