Search in sources :

Example 1 with NullMessageSendJob

use of org.thoughtcrime.securesms.jobs.NullMessageSendJob in project Signal-Android by WhisperSystems.

the class MessageContentProcessor method handleIndividualRetryReceipt.

private void handleIndividualRetryReceipt(@NonNull Recipient requester, @Nullable MessageLogEntry messageLogEntry, @NonNull SignalServiceContent content, @NonNull DecryptionErrorMessage decryptionErrorMessage) {
    boolean archivedSession = false;
    if (decryptionErrorMessage.getRatchetKey().isPresent() && ratchetKeyMatches(requester, content.getSenderDevice(), decryptionErrorMessage.getRatchetKey().get())) {
        warn(content.getTimestamp(), "[RetryReceipt-I] Ratchet key matches. Archiving the session.");
        ApplicationDependencies.getProtocolStore().aci().sessions().archiveSession(requester.getId(), content.getSenderDevice());
        archivedSession = true;
    }
    if (messageLogEntry != null) {
        warn(content.getTimestamp(), "[RetryReceipt-I] Found an entry in the MSL. Resending.");
        ApplicationDependencies.getJobManager().add(new ResendMessageJob(messageLogEntry.getRecipientId(), messageLogEntry.getDateSent(), messageLogEntry.getContent(), messageLogEntry.getContentHint(), null, null));
    } else if (archivedSession) {
        warn(content.getTimestamp(), "[RetryReceipt-I] Could not find an entry in the MSL, but we archived the session, so we're sending a null message to complete the reset.");
        ApplicationDependencies.getJobManager().add(new NullMessageSendJob(requester.getId()));
    } else {
        warn(content.getTimestamp(), "[RetryReceipt-I] Could not find an entry in the MSL. Skipping.");
    }
}
Also used : ResendMessageJob(org.thoughtcrime.securesms.jobs.ResendMessageJob) NullMessageSendJob(org.thoughtcrime.securesms.jobs.NullMessageSendJob)

Aggregations

NullMessageSendJob (org.thoughtcrime.securesms.jobs.NullMessageSendJob)1 ResendMessageJob (org.thoughtcrime.securesms.jobs.ResendMessageJob)1