diff options
Diffstat (limited to 'bridge/whatsappmulti')
-rw-r--r-- | bridge/whatsappmulti/handlers.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bridge/whatsappmulti/handlers.go b/bridge/whatsappmulti/handlers.go index b8e78572..d99c6727 100644 --- a/bridge/whatsappmulti/handlers.go +++ b/bridge/whatsappmulti/handlers.go @@ -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 +} |