]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/SendReceiptCommand.java
Update libsignal-service-java
[signal-cli] / src / main / java / org / asamk / signal / commands / SendReceiptCommand.java
index afdbd4f8137a60477b00328afc69bdac80b7bba6..0d5772ecc81723c747cbfd0ec37132a00c5cbc11 100644 (file)
@@ -7,8 +7,8 @@ import org.asamk.signal.OutputWriter;
 import org.asamk.signal.commands.exceptions.CommandException;
 import org.asamk.signal.commands.exceptions.UserErrorException;
 import org.asamk.signal.manager.Manager;
 import org.asamk.signal.commands.exceptions.CommandException;
 import org.asamk.signal.commands.exceptions.UserErrorException;
 import org.asamk.signal.manager.Manager;
+import org.asamk.signal.manager.UntrustedIdentityException;
 import org.asamk.signal.util.CommandUtil;
 import org.asamk.signal.util.CommandUtil;
-import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
 
 import java.io.IOException;
 
 
 import java.io.IOException;
 
@@ -27,7 +27,9 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
                 .type(long.class)
                 .nargs("+")
                 .help("Specify the timestamp of the messages for which a receipt should be sent.");
                 .type(long.class)
                 .nargs("+")
                 .help("Specify the timestamp of the messages for which a receipt should be sent.");
-        subparser.addArgument("--type").help("Specify the receipt type.").choices("read", "viewed").setDefault("read");
+        subparser.addArgument("--type")
+                .help("Specify the receipt type (default is read receipt).")
+                .choices("read", "viewed");
     }
 
     @Override
     }
 
     @Override
@@ -41,7 +43,7 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
         final var type = ns.getString("type");
 
         try {
         final var type = ns.getString("type");
 
         try {
-            if ("read".equals(type)) {
+            if (type == null || "read".equals(type)) {
                 m.sendReadReceipt(recipient, targetTimestamps);
             } else if ("viewed".equals(type)) {
                 m.sendViewedReceipt(recipient, targetTimestamps);
                 m.sendReadReceipt(recipient, targetTimestamps);
             } else if ("viewed".equals(type)) {
                 m.sendViewedReceipt(recipient, targetTimestamps);
@@ -49,7 +51,8 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
                 throw new UserErrorException("Unknown receipt type: " + type);
             }
         } catch (IOException | UntrustedIdentityException e) {
                 throw new UserErrorException("Unknown receipt type: " + type);
             }
         } catch (IOException | UntrustedIdentityException e) {
-            throw new UserErrorException("Failed to send message: " + e.getMessage());
+            throw new UserErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")");
         }
     }
 }
         }
     }
 }