Skip to content

Commit

Permalink
handlewhatsapp: fix handling messages that become decryptable
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 16, 2024
1 parent ec87e7b commit d604b0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/connector/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ func (evt *WAMessageEvent) GetType() bridgev2.RemoteEventType {

func (evt *WAMessageEvent) HandleExisting(ctx context.Context, portal *bridgev2.Portal, intent bridgev2.MatrixAPI, existing []*database.Message) (bridgev2.UpsertResult, error) {
if existing[0].Metadata.(*waid.MessageMetadata).Error == waid.MsgErrDecryptionFailed {
zerolog.Ctx(ctx).Debug().Stringer("existing_mxid", existing[0].MXID).Msg("Ignoring duplicate message")
zerolog.Ctx(ctx).Debug().
Stringer("existing_mxid", existing[0].MXID).
Msg("Received decryptable version of previously undecryptable message")
evt.isUndecryptableUpsertSubEvent = true
return bridgev2.UpsertResult{SubEvents: []bridgev2.RemoteEvent{
&WANowDecryptableMessage{WAMessageEvent: evt, editParts: existing}},
Expand Down Expand Up @@ -207,7 +209,7 @@ func (evt *WANowDecryptableMessage) AddLogContext(c zerolog.Context) zerolog.Con
}

func (evt *WANowDecryptableMessage) GetType() bridgev2.RemoteEventType {
return bridgev2.RemoteEventMessage
return bridgev2.RemoteEventEdit
}

type WAUndecryptableMessage struct {
Expand Down

0 comments on commit d604b0f

Please sign in to comment.