X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/1bf848cde1311314ca754b734e2b7cd951a3f979..db756bfe10ab302d9991e68ec4b5ed34230d39e2:/src/main/java/org/asamk/signal/App.java diff --git a/src/main/java/org/asamk/signal/App.java b/src/main/java/org/asamk/signal/App.java index 873e96bd..521e453a 100644 --- a/src/main/java/org/asamk/signal/App.java +++ b/src/main/java/org/asamk/signal/App.java @@ -55,7 +55,7 @@ public class App { parser.addArgument("--config") .help("Set the path, where to store the config (Default: $XDG_DATA_HOME/signal-cli , $HOME/.local/share/signal-cli)."); - parser.addArgument("-u", "--username").help("Specify your phone number, that will be used for verification."); + parser.addArgument("-u", "--username").help("Specify your phone number, that will be your identifier."); var mut = parser.addMutuallyExclusiveGroup(); mut.addArgument("--dbus").help("Make request via user dbus.").action(Arguments.storeTrue()); @@ -66,6 +66,11 @@ public class App { .type(Arguments.enumStringType(OutputType.class)) .setDefault(OutputType.PLAIN_TEXT); + parser.addArgument("--service-environment") + .help("Choose the server environment to use, SANDBOX or LIVE.") + .type(Arguments.enumStringType(ServiceEnvironmentCli.class)) + .setDefault(ServiceEnvironmentCli.LIVE); + var subparsers = parser.addSubparsers().title("subcommands").dest("command"); final var commands = Commands.getCommands(); @@ -88,15 +93,15 @@ public class App { throw new UserErrorException("Command not implemented!"); } - OutputType outputType = ns.get("output"); + var outputType = ns.get("output"); if (!command.getSupportedOutputTypes().contains(outputType)) { throw new UserErrorException("Command doesn't support output type " + outputType.toString()); } var username = ns.getString("username"); - final boolean useDbus = ns.getBoolean("dbus"); - final boolean useDbusSystem = ns.getBoolean("dbus_system"); + final var useDbus = ns.getBoolean("dbus"); + final var useDbusSystem = ns.getBoolean("dbus_system"); if (useDbus || useDbusSystem) { // If username is null, it will connect to the default object path initDbusClient(command, username, useDbusSystem); @@ -111,7 +116,10 @@ public class App { dataPath = getDefaultDataPath(); } - final var serviceEnvironment = ServiceEnvironment.LIVE; + final var serviceEnvironmentCli = ns.get("service_environment"); + final var serviceEnvironment = serviceEnvironmentCli == ServiceEnvironmentCli.LIVE + ? ServiceEnvironment.LIVE + : ServiceEnvironment.SANDBOX; if (!ServiceConfig.getCapabilities().isGv2()) { logger.warn("WARNING: Support for new group V2 is disabled," @@ -241,6 +249,7 @@ public class App { } catch (NotRegisteredException e) { throw new UserErrorException("User " + username + " is not registered."); } catch (Throwable e) { + logger.debug("Loading state file failed", e); throw new UnexpectedErrorException("Error loading state file for user " + username + ": " @@ -309,11 +318,13 @@ public class App { var legacySettingsPath = new File(configPath, "signal"); if (legacySettingsPath.exists()) { + logger.warn("Using legacy data path \"{}\", please move it to \"{}\".", legacySettingsPath, dataPath); return legacySettingsPath; } legacySettingsPath = new File(configPath, "textsecure"); if (legacySettingsPath.exists()) { + logger.warn("Using legacy data path \"{}\", please move it to \"{}\".", legacySettingsPath, dataPath); return legacySettingsPath; }