X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/778adacb80bae7d6ecc1d70fa87f9217c7bc1c71..5c389c875d91bacba127d0e9cbdc1746b022e5aa:/src/main/java/org/asamk/signal/commands/DaemonCommand.java diff --git a/src/main/java/org/asamk/signal/commands/DaemonCommand.java b/src/main/java/org/asamk/signal/commands/DaemonCommand.java index 02063b87..9627d9fb 100644 --- a/src/main/java/org/asamk/signal/commands/DaemonCommand.java +++ b/src/main/java/org/asamk/signal/commands/DaemonCommand.java @@ -23,7 +23,6 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; -import java.util.concurrent.TimeUnit; public class DaemonCommand implements MultiLocalCommand { @@ -55,6 +54,7 @@ public class DaemonCommand implements MultiLocalCommand { final Namespace ns, final Manager m, final OutputWriter outputWriter ) throws CommandException { boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments")); + m.setIgnoreAttachments(ignoreAttachments); DBusConnection.DBusBusType busType; if (Boolean.TRUE.equals(ns.getBoolean("system"))) { @@ -65,7 +65,7 @@ public class DaemonCommand implements MultiLocalCommand { try (var conn = DBusConnection.getConnection(busType)) { var objectPath = DbusConfig.getObjectPath(); - var t = run(conn, objectPath, m, outputWriter, ignoreAttachments); + var t = run(conn, objectPath, m, outputWriter); conn.requestBusName(DbusConfig.getBusname()); @@ -94,9 +94,10 @@ public class DaemonCommand implements MultiLocalCommand { try (var conn = DBusConnection.getConnection(busType)) { final var signalControl = new DbusSignalControlImpl(c, m -> { + m.setIgnoreAttachments(ignoreAttachments); try { final var objectPath = DbusConfig.getObjectPath(m.getSelfNumber()); - return run(conn, objectPath, m, outputWriter, ignoreAttachments); + return run(conn, objectPath, m, outputWriter); } catch (DBusException e) { logger.error("Failed to export object", e); return null; @@ -118,7 +119,7 @@ public class DaemonCommand implements MultiLocalCommand { } private Thread run( - DBusConnection conn, String objectPath, Manager m, OutputWriter outputWriter, boolean ignoreAttachments + DBusConnection conn, String objectPath, Manager m, OutputWriter outputWriter ) throws DBusException { final var signal = new DbusSignalImpl(m, conn, objectPath); conn.exportObject(signal); @@ -133,7 +134,7 @@ public class DaemonCommand implements MultiLocalCommand { final var receiveMessageHandler = outputWriter instanceof JsonWriter ? new JsonDbusReceiveMessageHandler(m, (JsonWriter) outputWriter, conn, objectPath) : new DbusReceiveMessageHandler(m, (PlainTextWriter) outputWriter, conn, objectPath); - m.receiveMessages(1, TimeUnit.HOURS, false, ignoreAttachments, receiveMessageHandler); + m.receiveMessages(receiveMessageHandler); break; } catch (IOException e) { logger.warn("Receiving messages failed, retrying", e);