X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/5a2e37a6e242b920e5647e3d98c2aecb1932f763..f5ba7894ae06909baeebfe9c23ccb9ab6b00a147:/src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java diff --git a/src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java b/src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java index d0e4dfec..349bd0c4 100644 --- a/src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java +++ b/src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java @@ -65,7 +65,8 @@ public class JsonRpcDispatcherCommand implements LocalCommand { public void handleCommand( final Namespace ns, final Manager m, final OutputWriter outputWriter ) throws CommandException { - final boolean ignoreAttachments = ns.getBoolean("ignore-attachments"); + final boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments")); + m.setIgnoreAttachments(ignoreAttachments); final var objectMapper = Util.createJsonObjectMapper(); final var jsonRpcSender = new JsonRpcSender((JsonWriter) outputWriter); @@ -73,7 +74,7 @@ public class JsonRpcDispatcherCommand implements LocalCommand { final var receiveThread = receiveMessages(s -> jsonRpcSender.sendRequest(JsonRpcRequest.forNotification( "receive", objectMapper.valueToTree(s), - null)), m, ignoreAttachments); + null)), m); // Maybe this should be handled inside the Manager while (!m.hasCaughtUpWithOldMessages()) { @@ -167,14 +168,12 @@ public class JsonRpcDispatcherCommand implements LocalCommand { command.handleCommand(requestParams, m, outputWriter); } - private Thread receiveMessages( - JsonWriter jsonWriter, Manager m, boolean ignoreAttachments - ) { + private Thread receiveMessages(JsonWriter jsonWriter, Manager m) { final var thread = new Thread(() -> { while (!Thread.interrupted()) { try { final var receiveMessageHandler = new JsonReceiveMessageHandler(m, jsonWriter); - m.receiveMessages(1, TimeUnit.HOURS, false, ignoreAttachments, receiveMessageHandler); + m.receiveMessages(1, TimeUnit.HOURS, false, receiveMessageHandler); break; } catch (IOException e) { logger.warn("Receiving messages failed, retrying", e);