]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/RemoteDeleteCommand.java
Fix error type for dbus rate limit challenge
[signal-cli] / src / main / java / org / asamk / signal / commands / RemoteDeleteCommand.java
index e515defefa4d05ab037faad4ac91bb06de8acc94..2b9ebe918e4e748be3a0b6acbd78d4b94eb2ca1c 100644 (file)
@@ -43,7 +43,7 @@ public class RemoteDeleteCommand implements JsonRpcLocalCommand {
     public void handleCommand(
             final Namespace ns, final Manager m, final OutputWriter outputWriter
     ) throws CommandException {
-        final var isNoteToSelf = ns.getBoolean("note-to-self");
+        final var isNoteToSelf = Boolean.TRUE.equals(ns.getBoolean("note-to-self"));
         final var recipientStrings = ns.<String>getList("recipient");
         final var groupIdStrings = ns.<String>getList("group-id");
 
@@ -56,8 +56,8 @@ public class RemoteDeleteCommand implements JsonRpcLocalCommand {
 
         try {
             final var results = m.sendRemoteDeleteMessage(targetTimestamp, recipientIdentifiers);
-            outputResult(outputWriter, results.getTimestamp());
-            ErrorUtils.handleSendMessageResults(results.getResults());
+            outputResult(outputWriter, results.timestamp());
+            ErrorUtils.handleSendMessageResults(results.results());
         } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new UserErrorException(e.getMessage());
         } catch (IOException e) {
@@ -67,8 +67,7 @@ public class RemoteDeleteCommand implements JsonRpcLocalCommand {
     }
 
     private void outputResult(final OutputWriter outputWriter, final long timestamp) {
-        if (outputWriter instanceof PlainTextWriter) {
-            final var writer = (PlainTextWriter) outputWriter;
+        if (outputWriter instanceof PlainTextWriter writer) {
             writer.println("{}", timestamp);
         } else {
             final var writer = (JsonWriter) outputWriter;