mirror of
https://github.com/mautrix/whatsapp.git
synced 2026-08-22 12:04:55 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc2a111078 |
1 changed files with 11 additions and 4 deletions
|
|
@ -255,10 +255,11 @@ func (wa *WhatsAppConnector) makeDirectMediaResponse(
|
||||||
|
|
||||||
type directMediaRetry struct {
|
type directMediaRetry struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
resultURL string
|
resultURL string
|
||||||
wait *exsync.Event
|
wait *exsync.Event
|
||||||
requested bool
|
requested bool
|
||||||
resultType waMmsRetry.MediaRetryNotification_ResultType
|
resultType waMmsRetry.MediaRetryNotification_ResultType
|
||||||
|
decryptFail bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wa *WhatsAppClient) getDirectMediaRetryState(msgID networkid.MessageID, create bool) *directMediaRetry {
|
func (wa *WhatsAppClient) getDirectMediaRetryState(msgID networkid.MessageID, create bool) *directMediaRetry {
|
||||||
|
|
@ -285,6 +286,9 @@ func (wa *WhatsAppClient) requestAndWaitDirectMedia(ctx context.Context, rawMsgI
|
||||||
keys.DirectPath = state.resultURL
|
keys.DirectPath = state.resultURL
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if state.decryptFail {
|
||||||
|
return mautrix.MNotFound.WithMessage("Unable to retrieve media: failed to decrypt the media retry notification from your phone.")
|
||||||
|
}
|
||||||
switch state.resultType {
|
switch state.resultType {
|
||||||
case waMmsRetry.MediaRetryNotification_NOT_FOUND:
|
case waMmsRetry.MediaRetryNotification_NOT_FOUND:
|
||||||
return mautrix.MNotFound.WithMessage("This media was not found on your phone.")
|
return mautrix.MNotFound.WithMessage("This media was not found on your phone.")
|
||||||
|
|
@ -338,6 +342,9 @@ func (wa *WhatsAppClient) receiveDirectMediaRetry(ctx context.Context, msg *data
|
||||||
retryData, err := whatsmeow.DecryptMediaRetryNotification(retry, keys.Key)
|
retryData, err := whatsmeow.DecryptMediaRetryNotification(retry, keys.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Err(err).Msg("Failed to decrypt media retry notification")
|
log.Warn().Err(err).Msg("Failed to decrypt media retry notification")
|
||||||
|
if state != nil {
|
||||||
|
state.decryptFail = true
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if state != nil {
|
if state != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue