mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Request message resend if incoming message can't be decrypted
This commit is contained in:
parent
fbafa75fe2
commit
62d8873a92
7 changed files with 158 additions and 6 deletions
|
@ -8,6 +8,7 @@ import org.asamk.signal.manager.groups.GroupUtils;
|
|||
import org.asamk.signal.util.DateUtils;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.slf4j.helpers.MessageFormatter;
|
||||
import org.whispersystems.libsignal.protocol.DecryptionErrorMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
|
@ -113,6 +114,11 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
var typingMessage = content.getTypingMessage().get();
|
||||
printTypingMessage(writer.indentedWriter(), typingMessage);
|
||||
}
|
||||
if (content.getDecryptionErrorMessage().isPresent()) {
|
||||
writer.println("Received a decryption error message (resend request)");
|
||||
var decryptionErrorMessage = content.getDecryptionErrorMessage().get();
|
||||
printDecryptionErrorMessage(writer.indentedWriter(), decryptionErrorMessage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
writer.println("Unknown message received.");
|
||||
|
@ -215,6 +221,15 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private void printDecryptionErrorMessage(
|
||||
final PlainTextWriter writer, final DecryptionErrorMessage decryptionErrorMessage
|
||||
) {
|
||||
writer.println("Device id: {}", decryptionErrorMessage.getDeviceId());
|
||||
writer.println("Timestamp: {}", DateUtils.formatTimestamp(decryptionErrorMessage.getTimestamp()));
|
||||
writer.println("Ratchet key: {}",
|
||||
decryptionErrorMessage.getRatchetKey().isPresent() ? "is present" : "not present");
|
||||
}
|
||||
|
||||
private void printReceiptMessage(
|
||||
final PlainTextWriter writer, final SignalServiceReceiptMessage receiptMessage
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue