Add option to send read receipts for all received data messages

Fixes #850
This commit is contained in:
AsamK 2022-05-26 18:00:23 +02:00
parent fd92a96e1a
commit 27dbc671e0
7 changed files with 30 additions and 6 deletions

View file

@ -34,6 +34,9 @@ public class JsonRpcDispatcherCommand implements LocalCommand {
subparser.addArgument("--ignore-attachments")
.help("Dont download attachments of received messages.")
.action(Arguments.storeTrue());
subparser.addArgument("--send-read-receipts")
.help("Send read receipts for all incoming data messages (in addition to the default delivery receipts)")
.action(Arguments.storeTrue());
}
@Override
@ -46,7 +49,8 @@ public class JsonRpcDispatcherCommand implements LocalCommand {
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
final boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
m.setReceiveConfig(new ReceiveConfig(ignoreAttachments));
final boolean sendReadReceipts = Boolean.TRUE.equals(ns.getBoolean("send-read-receipts"));
m.setReceiveConfig(new ReceiveConfig(ignoreAttachments, sendReadReceipts));
final var jsonOutputWriter = (JsonWriter) outputWriter;
final Supplier<String> lineSupplier = IOUtils.getLineSupplier(new InputStreamReader(System.in,