Use exit 4 when sending a single recipient message fails due to untrusted identity key

Fixes #88
This commit is contained in:
AsamK 2021-01-16 15:38:38 +01:00
parent e1134d832a
commit 06404667a1
6 changed files with 57 additions and 25 deletions

View file

@ -953,7 +953,7 @@ public class Manager implements Closeable {
return sendMessage(messageBuilder, getSignalServiceAddresses(recipients));
}
public Pair<Long, List<SendMessageResult>> sendSelfMessage(
public Pair<Long, SendMessageResult> sendSelfMessage(
String messageText, List<String> attachments
) throws IOException, AttachmentInvalidException {
final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
@ -1278,7 +1278,7 @@ public class Manager implements Closeable {
}
}
private Pair<Long, List<SendMessageResult>> sendSelfMessage(
private Pair<Long, SendMessageResult> sendSelfMessage(
SignalServiceDataMessage.Builder messageBuilder
) throws IOException {
final long timestamp = System.currentTimeMillis();
@ -1294,7 +1294,7 @@ public class Manager implements Closeable {
SignalServiceDataMessage message = messageBuilder.build();
final SendMessageResult result = sendSelfMessage(message);
return new Pair<>(timestamp, List.of(result));
return new Pair<>(timestamp, result);
} finally {
account.save();
}