X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/bf2a83755e33542a411d58701c5eb0eff3f1ebaf..a6ec71dc315e5b259a7bfe70cad46b7780b73fa9:/src/main/java/org/asamk/signal/commands/SendReceiptCommand.java diff --git a/src/main/java/org/asamk/signal/commands/SendReceiptCommand.java b/src/main/java/org/asamk/signal/commands/SendReceiptCommand.java index 1eec6c99..93c8a564 100644 --- a/src/main/java/org/asamk/signal/commands/SendReceiptCommand.java +++ b/src/main/java/org/asamk/signal/commands/SendReceiptCommand.java @@ -10,8 +10,6 @@ import org.asamk.signal.manager.api.SendMessageResults; import org.asamk.signal.output.OutputWriter; import org.asamk.signal.util.CommandUtil; -import java.io.IOException; - import static org.asamk.signal.util.SendMessageResultUtils.outputResult; public class SendReceiptCommand implements JsonRpcLocalCommand { @@ -37,7 +35,9 @@ public class SendReceiptCommand implements JsonRpcLocalCommand { @Override public void handleCommand( - final Namespace ns, final Manager m, final OutputWriter outputWriter + final Namespace ns, + final Manager m, + final OutputWriter outputWriter ) throws CommandException { final var recipientString = ns.getString("recipient"); final var recipient = CommandUtil.getSingleRecipientIdentifier(recipientString, m.getSelfNumber()); @@ -45,19 +45,14 @@ public class SendReceiptCommand implements JsonRpcLocalCommand { final var targetTimestamps = ns.getList("target-timestamp"); final var type = ns.getString("type"); - try { - final SendMessageResults results; - if (type == null || "read".equals(type)) { - results = m.sendReadReceipt(recipient, targetTimestamps); - } else if ("viewed".equals(type)) { - results = m.sendViewedReceipt(recipient, targetTimestamps); - } else { - throw new UserErrorException("Unknown receipt type: " + type); - } - outputResult(outputWriter, results); - } catch (IOException e) { - throw new UserErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass() - .getSimpleName() + ")"); + final SendMessageResults results; + if (type == null || "read".equals(type)) { + results = m.sendReadReceipt(recipient, targetTimestamps); + } else if ("viewed".equals(type)) { + results = m.sendViewedReceipt(recipient, targetTimestamps); + } else { + throw new UserErrorException("Unknown receipt type: " + type); } + outputResult(outputWriter, results); } }