mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-11 11:42:00 -08:00
Allow message deletes from any platform.
This commit is contained in:
parent
24f6747516
commit
e5c3536615
@ -361,7 +361,7 @@ func (b *Bwhatsapp) Send(msg config.Message) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
_, err := b.wc.RevokeMessage(groupJID, msg.ID)
|
||||
_, err := b.wc.SendMessage(context.Background(), groupJID, b.wc.BuildRevoke(groupJID, extendedMsgID.Sender, extendedMsgID.MessageID))
|
||||
|
||||
return "", err
|
||||
}
|
||||
|
@ -466,7 +466,8 @@ func (gw *Gateway) SendMessage(
|
||||
|
||||
// exclude file delete event as the msg ID here is the native file ID that needs to be deleted
|
||||
if msg.Event != config.EventFileDelete {
|
||||
msg.ID = gw.getDestMsgID(rmsg.Protocol+" "+rmsg.ID, dest, channel)
|
||||
canonicalMsgID := gw.FindCanonicalMsgID(rmsg.Protocol, rmsg.ID)
|
||||
msg.ID = gw.getDestMsgID(canonicalMsgID, dest, channel)
|
||||
}
|
||||
|
||||
// for api we need originchannel as channel
|
||||
|
@ -134,8 +134,9 @@ func (r *Router) handleReceive() {
|
||||
r.handleEventFailure(&msg)
|
||||
r.handleEventRejoinChannels(&msg)
|
||||
|
||||
srcBridge := r.getBridge(msg.Account)
|
||||
// Set message protocol based on the account it came from
|
||||
msg.Protocol = r.getBridge(msg.Account).Protocol
|
||||
msg.Protocol = srcBridge.Protocol
|
||||
|
||||
filesHandled := false
|
||||
for _, gw := range r.Gateways {
|
||||
@ -163,6 +164,11 @@ func (r *Router) handleReceive() {
|
||||
// This is necessary as msgIDs will change if a bridge returns
|
||||
// a different ID in response to edits.
|
||||
if !exists {
|
||||
// we're adding the original message as a "dest message"
|
||||
// as when we get the dest messages for a delete the source message isnt in the list
|
||||
// therefore the delete doesnt happen on the source platform.
|
||||
msgIDs = append(msgIDs, &BrMsgID{srcBridge, srcBridge.Protocol + " " + msg.ID, msg.Channel + srcBridge.Account})
|
||||
|
||||
gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user