refactor(retry): improve message encryption and retry logic (#2055)
This commit is contained in:
@@ -206,6 +206,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
||||
|
||||
const fullMessage: WAMessage = {
|
||||
key,
|
||||
category: stanza.attrs.category,
|
||||
messageTimestamp: +stanza.attrs.t!,
|
||||
pushName: pushname,
|
||||
broadcast: isJidBroadcast(from)
|
||||
@@ -248,6 +249,10 @@ export const decryptMessageNode = (
|
||||
fullMessage.key.isViewOnce = true // TODO: remove from here and add a STUB TYPE
|
||||
}
|
||||
|
||||
if (attrs.count && tag === 'enc') {
|
||||
fullMessage.retryCount = Number(attrs.count)
|
||||
}
|
||||
|
||||
if (tag !== 'enc' && tag !== 'plaintext') {
|
||||
continue
|
||||
}
|
||||
@@ -333,7 +338,7 @@ export const decryptMessageNode = (
|
||||
}
|
||||
|
||||
// if nothing was found to decrypt
|
||||
if (!decryptables) {
|
||||
if (!decryptables && !fullMessage.key?.isViewOnce) {
|
||||
fullMessage.messageStubType = proto.WebMessageInfo.StubType.CIPHERTEXT
|
||||
fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user