mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add --voice / -v option for voice call verification
This commit is contained in:
parent
9d71313a0c
commit
841519e27a
2 changed files with 12 additions and 4 deletions
|
@ -17,6 +17,7 @@
|
||||||
package cli;
|
package cli;
|
||||||
|
|
||||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||||
|
import net.sourceforge.argparse4j.impl.Arguments;
|
||||||
import net.sourceforge.argparse4j.inf.*;
|
import net.sourceforge.argparse4j.inf.*;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.whispersystems.libaxolotl.InvalidVersionException;
|
import org.whispersystems.libaxolotl.InvalidVersionException;
|
||||||
|
@ -45,9 +46,12 @@ public class Main {
|
||||||
.description("valid subcommands")
|
.description("valid subcommands")
|
||||||
.help("additional help");
|
.help("additional help");
|
||||||
Subparser parserRegister = subparsers.addParser("register");
|
Subparser parserRegister = subparsers.addParser("register");
|
||||||
|
parserRegister.addArgument("-v", "--voice")
|
||||||
|
.help("The verification should be done over voice, not sms.")
|
||||||
|
.action(Arguments.storeTrue());
|
||||||
Subparser parserVerify = subparsers.addParser("verify");
|
Subparser parserVerify = subparsers.addParser("verify");
|
||||||
parserVerify.addArgument("verificationCode")
|
parserVerify.addArgument("verificationCode")
|
||||||
.help("The verification code you received via sms.");
|
.help("The verification code you received via sms or voice call.");
|
||||||
Subparser parserSend = subparsers.addParser("send");
|
Subparser parserSend = subparsers.addParser("send");
|
||||||
parserSend.addArgument("recipient")
|
parserSend.addArgument("recipient")
|
||||||
.help("Specify the recipients' phone number.")
|
.help("Specify the recipients' phone number.")
|
||||||
|
@ -82,7 +86,7 @@ public class Main {
|
||||||
m.createNewIdentity();
|
m.createNewIdentity();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
m.register();
|
m.register(ns.getBoolean("voice"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Request verify error: " + e.getMessage());
|
System.out.println("Request verify error: " + e.getMessage());
|
||||||
System.exit(3);
|
System.exit(3);
|
||||||
|
|
|
@ -117,12 +117,16 @@ public class Manager {
|
||||||
return registered;
|
return registered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register() throws IOException {
|
public void register(boolean voiceVerication) throws IOException {
|
||||||
password = Util.getSecret(18);
|
password = Util.getSecret(18);
|
||||||
|
|
||||||
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password);
|
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password);
|
||||||
|
|
||||||
|
if (voiceVerication)
|
||||||
|
accountManager.requestVoiceVerificationCode();
|
||||||
|
else
|
||||||
accountManager.requestSmsVerificationCode();
|
accountManager.requestSmsVerificationCode();
|
||||||
|
|
||||||
registered = false;
|
registered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue