mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-04 12:43:10 +01:00
handlewhatsapp: handle undecryptable view-once messages
This commit is contained in:
parent
5dabca8dda
commit
96c00016f7
4 changed files with 13 additions and 4 deletions
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
github.com/rs/zerolog v1.33.0
|
||||
go.mau.fi/util v0.8.2
|
||||
go.mau.fi/webp v0.1.0
|
||||
go.mau.fi/whatsmeow v0.0.0-20241116141054-92458da42ba3
|
||||
go.mau.fi/whatsmeow v0.0.0-20241202173457-b2dd543e5721
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
|
||||
golang.org/x/image v0.22.0
|
||||
golang.org/x/net v0.31.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -69,8 +69,8 @@ go.mau.fi/util v0.8.2 h1:zWbVHwdRKwI6U9AusmZ8bwgcLosikwbb4GGqLrNr1YE=
|
|||
go.mau.fi/util v0.8.2/go.mod h1:BHHC9R2WLMJd1bwTZfTcFxUgRFmUgUmiWcT4RbzUgiA=
|
||||
go.mau.fi/webp v0.1.0 h1:BHObH/DcFntT9KYun5pDr0Ot4eUZO8k2C7eP7vF4ueA=
|
||||
go.mau.fi/webp v0.1.0/go.mod h1:e42Z+VMFrUMS9cpEwGRIor+lQWO8oUAyPyMtcL+NMt8=
|
||||
go.mau.fi/whatsmeow v0.0.0-20241116141054-92458da42ba3 h1:5BTCMPMvWcEJ+BIvci8S2+yqe09XIRqRYPt4SgB9y5o=
|
||||
go.mau.fi/whatsmeow v0.0.0-20241116141054-92458da42ba3/go.mod h1:iB+F/NVNOnyumU2p/TKTSSdBhH05GHFG36diYuFp9VQ=
|
||||
go.mau.fi/whatsmeow v0.0.0-20241202173457-b2dd543e5721 h1:NveCzJ+3fTWBNnHg5+0iVqjdPdFmCTw9MDY1yELUDx4=
|
||||
go.mau.fi/whatsmeow v0.0.0-20241202173457-b2dd543e5721/go.mod h1:iB+F/NVNOnyumU2p/TKTSSdBhH05GHFG36diYuFp9VQ=
|
||||
go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM=
|
||||
go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
|
|
|
@ -251,6 +251,7 @@ func (evt *WANowDecryptableMessage) GetType() bridgev2.RemoteEventType {
|
|||
|
||||
type WAUndecryptableMessage struct {
|
||||
*MessageInfoWrapper
|
||||
Type events.UnavailableType
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -283,10 +284,17 @@ func (evt *WAUndecryptableMessage) ConvertMessage(ctx context.Context, portal *b
|
|||
broadcastListJID = &evt.Info.Chat
|
||||
extra["fi.mau.whatsapp.source_broadcast_list"] = evt.Info.Chat.String()
|
||||
}
|
||||
content := &undecryptableMessageContent
|
||||
if evt.Type == events.UnavailableTypeViewOnce {
|
||||
content = &event.MessageEventContent{
|
||||
MsgType: event.MsgNotice,
|
||||
Body: "You received a view once message. For added privacy, you can only open it on the WhatsApp app.",
|
||||
}
|
||||
}
|
||||
return &bridgev2.ConvertedMessage{
|
||||
Parts: []*bridgev2.ConvertedMessagePart{{
|
||||
Type: event.EventMessage,
|
||||
Content: &undecryptableMessageContent,
|
||||
Content: content,
|
||||
Extra: extra,
|
||||
DBMetadata: &waid.MessageMetadata{
|
||||
SenderDeviceID: evt.Info.Sender.Device,
|
||||
|
|
|
@ -274,6 +274,7 @@ func (wa *WhatsAppClient) handleWAUndecryptableMessage(evt *events.Undecryptable
|
|||
Info: evt.Info,
|
||||
wa: wa,
|
||||
},
|
||||
Type: evt.UnavailableType,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue