mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-17 14:32:00 -08:00
Support handling delete message from whatsapp. (#1986)
This commit is contained in:
parent
08779c2909
commit
2c349c50c7
@ -44,6 +44,8 @@ func (b *Bwhatsapp) handleMessage(message *events.Message) {
|
||||
b.handleDocumentMessage(message)
|
||||
case msg.ImageMessage != nil:
|
||||
b.handleImageMessage(message)
|
||||
case msg.ProtocolMessage != nil && *msg.ProtocolMessage.Type == proto.ProtocolMessage_REVOKE:
|
||||
b.handleDelete(msg.ProtocolMessage)
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,3 +361,20 @@ func (b *Bwhatsapp) handleDocumentMessage(msg *events.Message) {
|
||||
|
||||
b.Remote <- rmsg
|
||||
}
|
||||
|
||||
func (b *Bwhatsapp) handleDelete(messageInfo *proto.ProtocolMessage) {
|
||||
sender, _ := types.ParseJID(*messageInfo.Key.Participant)
|
||||
|
||||
rmsg := config.Message{
|
||||
Account: b.Account,
|
||||
Protocol: b.Protocol,
|
||||
ID: getMessageIdFormat(sender, *messageInfo.Key.Id),
|
||||
Event: config.EventMsgDelete,
|
||||
Text: config.EventMsgDelete,
|
||||
Channel: *messageInfo.Key.RemoteJid,
|
||||
}
|
||||
|
||||
b.Log.Debugf("<= Sending message from %s to gateway", b.Account)
|
||||
b.Log.Debugf("<= Message is %#v", rmsg)
|
||||
b.Remote <- rmsg
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user