]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/VerifyCommand.java
Allow message from pending member if it's just a group update
[signal-cli] / src / main / java / org / asamk / signal / commands / VerifyCommand.java
index c26c1d3a0701a949b865f1407ff7b2fcadd31b4d..b7fffcd23ca5c663c2abb2247c2652121483ad78 100644 (file)
@@ -16,8 +16,14 @@ import java.io.IOException;
 
 public class VerifyCommand implements RegistrationCommand {
 
+    @Override
+    public String getName() {
+        return "verify";
+    }
+
     @Override
     public void attachToSubparser(final Subparser subparser) {
+        subparser.help("Verify the number using the code received via SMS or voice.");
         subparser.addArgument("verificationCode").help("The verification code you received via sms or voice call.");
         subparser.addArgument("-p", "--pin").help("The registration lock PIN, that was set by the user (Optional)");
     }
@@ -28,7 +34,8 @@ public class VerifyCommand implements RegistrationCommand {
         var pin = ns.getString("pin");
 
         try {
-            m.verifyAccount(verificationCode, pin);
+            final var manager = m.verifyAccount(verificationCode, pin);
+            manager.close();
         } catch (LockedException e) {
             throw new UserErrorException(
                     "Verification failed! This number is locked with a pin. Hours remaining until reset: "
@@ -37,9 +44,9 @@ public class VerifyCommand implements RegistrationCommand {
         } catch (KeyBackupServicePinException e) {
             throw new UserErrorException("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
         } catch (KeyBackupSystemNoDataException e) {
-            throw new UnexpectedErrorException("Verification failed! No KBS data.");
+            throw new UnexpectedErrorException("Verification failed! No KBS data.", e);
         } catch (IOException e) {
-            throw new IOErrorException("Verify error: " + e.getMessage());
+            throw new IOErrorException("Verify error: " + e.getMessage(), e);
         }
     }
 }