summaryrefslogtreecommitdiffstats
path: root/bridge/whatsappmulti
diff options
context:
space:
mode:
authorJoseph Mansy <36427684+yousefmansy1@users.noreply.github.com>2023-03-10 13:28:32 -0800
committerGitHub <noreply@github.com>2023-03-10 22:28:32 +0100
commit2c349c50c72ad2eb503d08bd59e4fc98b3c7e9a0 (patch)
treeac020a26f23165cfc25edd7f8fbb3916a11de6ad /bridge/whatsappmulti
parent08779c29099e8940493df56d28d8aa131ac8342e (diff)
downloadmatterbridge-msglm-2c349c50c72ad2eb503d08bd59e4fc98b3c7e9a0.tar.gz
matterbridge-msglm-2c349c50c72ad2eb503d08bd59e4fc98b3c7e9a0.tar.bz2
matterbridge-msglm-2c349c50c72ad2eb503d08bd59e4fc98b3c7e9a0.zip
Support handling delete message from whatsapp. (#1986)
Diffstat (limited to 'bridge/whatsappmulti')
-rw-r--r--bridge/whatsappmulti/handlers.go19
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
+}