Thumbnail

rani/matterbridge.git

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

commit 2aa09319c646548e8eec634460ff2389a52b29e3 Author: Wim <wim@42.be> Date: Sat Jan 20 21:58:59 2018 +0000 Make edits/delete work for bridges that gets reused. Closes #342 diff --git a/gateway/gateway.go b/gateway/gateway.go index 0c55b0b..89ea80a 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -298 +299 @@ 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 { @@ -1907 +1919 @@ 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   }   } @@ -2057 +2087 @@ 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