summaryrefslogtreecommitdiffstats
path: root/gateway/gateway.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-01-20 21:58:59 +0100
committerWim <wim@42.be>2018-01-20 21:58:59 +0100
commita4d5c94d9bb06349ffdfc15893e431486f6c1a74 (patch)
treec74fc116f07547b2038797bceac2d1d2b50a1959 /gateway/gateway.go
parent7119e378a7c01fea76f6541fdcc081827862ce66 (diff)
downloadmatterbridge-msglm-a4d5c94d9bb06349ffdfc15893e431486f6c1a74.tar.gz
matterbridge-msglm-a4d5c94d9bb06349ffdfc15893e431486f6c1a74.tar.bz2
matterbridge-msglm-a4d5c94d9bb06349ffdfc15893e431486f6c1a74.zip
Make edits/delete work for bridges that gets reused. Closes #342
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r--gateway/gateway.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 0c55b0be..89ea80ab 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -29,8 +29,9 @@ type Gateway struct {
}
type BrMsgID struct {
- br *bridge.Bridge
- ID string
+ br *bridge.Bridge
+ ID string
+ ChannelID string
}
func New(cfg config.Gateway, r *Router) *Gateway {
@@ -190,7 +191,9 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
if res, ok := gw.Messages.Get(origmsg.ID); ok {
IDs := res.([]*BrMsgID)
for _, id := range IDs {
- if dest.Protocol == id.br.Protocol {
+ // check protocol, bridge name and channelname
+ // for people that reuse the same bridge multiple times. see #342
+ if dest.Protocol == id.br.Protocol && dest.Name == id.br.Name && channel.ID == id.ChannelID {
msg.ID = id.ID
}
}
@@ -205,7 +208,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
}
// append the message ID (mID) from this bridge (dest) to our brMsgIDs slice
if mID != "" {
- brMsgIDs = append(brMsgIDs, &BrMsgID{dest, mID})
+ brMsgIDs = append(brMsgIDs, &BrMsgID{dest, mID, channel.ID})
}
}
return brMsgIDs