|
|
|
@ -2132,35 +2132,35 @@
|
|
|
|
|
|
|
|
|
|
const message = new Whisper.Message(messageData);
|
|
|
|
|
|
|
|
|
|
// If we don't return early here, we can get into infinite error loops. So, no
|
|
|
|
|
// delivery receipts for sealed sender errors.
|
|
|
|
|
|
|
|
|
|
// Send a delivery receipt
|
|
|
|
|
// If we don't return early here, we can get into infinite error loops. So, no delivery receipts for sealed sender errors.
|
|
|
|
|
// Note(LOKI): don't send receipt for FR as we don't have a session yet
|
|
|
|
|
if (isError || !data.unidentifiedDeliveryReceived || data.friendRequest) {
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const isGroup = data && data.message && data.message.group;
|
|
|
|
|
const shouldSendReceipt =
|
|
|
|
|
!isError &&
|
|
|
|
|
data.unidentifiedDeliveryReceived &&
|
|
|
|
|
!data.isFriendRequest &&
|
|
|
|
|
!isGroup;
|
|
|
|
|
|
|
|
|
|
// Send the receipt async and hope that it succeeds
|
|
|
|
|
if (shouldSendReceipt) {
|
|
|
|
|
const { wrap, sendOptions } = ConversationController.prepareForSend(
|
|
|
|
|
data.source
|
|
|
|
|
);
|
|
|
|
|
const isGroup = data && data.message && data.message.group;
|
|
|
|
|
if (!isGroup) {
|
|
|
|
|
await wrap(
|
|
|
|
|
textsecure.messaging.sendDeliveryReceipt(
|
|
|
|
|
data.source,
|
|
|
|
|
data.timestamp,
|
|
|
|
|
sendOptions
|
|
|
|
|
)
|
|
|
|
|
wrap(
|
|
|
|
|
textsecure.messaging.sendDeliveryReceipt(
|
|
|
|
|
data.source,
|
|
|
|
|
data.timestamp,
|
|
|
|
|
sendOptions
|
|
|
|
|
)
|
|
|
|
|
).catch(error => {
|
|
|
|
|
window.log.error(
|
|
|
|
|
`Failed to send delivery receipt to ${data.source} for message ${
|
|
|
|
|
data.timestamp
|
|
|
|
|
}:`,
|
|
|
|
|
error && error.stack ? error.stack : error
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
window.log.error(
|
|
|
|
|
`Failed to send delivery receipt to ${data.source} for message ${
|
|
|
|
|
data.timestamp
|
|
|
|
|
}:`,
|
|
|
|
|
error && error.stack ? error.stack : error
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|