mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-24 18:25:40 +00:00
Obey the Gateway value from the json (api). Closes #344
This commit is contained in:
parent
7c6ce8bb90
commit
6523494e83
@ -119,6 +119,12 @@ 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
|
||||
@ -321,7 +327,11 @@ 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user