X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/221d937eecca5c9b09a3bee7df812203b9927a56..3de30e166f4eb6be0cd10548ed2c6cce2fe2282e:/src/main/java/org/asamk/signal/commands/ReceiveCommand.java diff --git a/src/main/java/org/asamk/signal/commands/ReceiveCommand.java b/src/main/java/org/asamk/signal/commands/ReceiveCommand.java index 8612a71b..47f9aa84 100644 --- a/src/main/java/org/asamk/signal/commands/ReceiveCommand.java +++ b/src/main/java/org/asamk/signal/commands/ReceiveCommand.java @@ -27,8 +27,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; -import static org.asamk.signal.util.ErrorUtils.handleAssertionError; - public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand { private final static Logger logger = LoggerFactory.getLogger(ReceiveCommand.class); @@ -37,6 +35,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand { public void attachToSubparser(final Subparser subparser) { subparser.addArgument("-t", "--timeout") .type(double.class) + .setDefault(3.0) .help("Number of seconds to wait for new messages (negative values disable timeout)"); subparser.addArgument("--ignore-attachments") .help("Don’t download attachments of received messages.") @@ -150,16 +149,13 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand { logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead."); } - double timeout = 5; - if (ns.getDouble("timeout") != null) { - timeout = ns.getDouble("timeout"); - } + double timeout = ns.getDouble("timeout"); var returnOnTimeout = true; if (timeout < 0) { returnOnTimeout = false; timeout = 3600; } - boolean ignoreAttachments = ns.getBoolean("ignore_attachments"); + boolean ignoreAttachments = ns.getBoolean("ignore-attachments"); try { final var handler = inJson ? new JsonReceiveMessageHandler(m) : new ReceiveMessageHandler(m); m.receiveMessages((long) (timeout * 1000), @@ -169,9 +165,6 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand { handler); } catch (IOException e) { throw new IOErrorException("Error while receiving messages: " + e.getMessage()); - } catch (AssertionError e) { - handleAssertionError(e); - throw e; } } }