mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 04:20:38 +00:00
Added better depricated warning message and clarified some java doc stuff
This commit is contained in:
parent
eb401df4a2
commit
ca7754f554
3 changed files with 30 additions and 7 deletions
|
@ -8,6 +8,8 @@ import net.sourceforge.argparse4j.inf.Namespace;
|
|||
import net.sourceforge.argparse4j.inf.Subparser;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
|
@ -17,6 +19,9 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class GetUserStatusCommand implements LocalCommand {
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
final static Logger logger = LoggerFactory.getLogger(GetUserStatusCommand.class);
|
||||
|
||||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.addArgument("number").help("Phone number").nargs("+");
|
||||
|
@ -32,6 +37,13 @@ public class GetUserStatusCommand implements LocalCommand {
|
|||
ObjectMapper jsonProcessor = new ObjectMapper();
|
||||
jsonProcessor.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
|
||||
|
||||
boolean inJson = ns.getString("output").equals("json");
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
if (ns.getBoolean("json")) {
|
||||
logger.warn("\"--json\" option has been deprecated, please use \"output\" instead.");
|
||||
}
|
||||
|
||||
// Get a map of registration statuses
|
||||
Map<String, Boolean> registered;
|
||||
try {
|
||||
|
@ -41,12 +53,6 @@ public class GetUserStatusCommand implements LocalCommand {
|
|||
return 1;
|
||||
}
|
||||
|
||||
boolean inJson = ns.getString("output").equals("json");
|
||||
if (ns.getBoolean("json")) {
|
||||
inJson = true;
|
||||
System.out.println("WARNING: This parameter is now deprecated! Please use the \"output\" parameter instead.");
|
||||
}
|
||||
|
||||
// Output
|
||||
if (inJson) {
|
||||
List<JsonIsRegistered> objects = registered.entrySet()
|
||||
|
|
|
@ -20,6 +20,10 @@ import org.freedesktop.dbus.connections.impl.DBusConnection;
|
|||
import org.freedesktop.dbus.exceptions.DBusException;
|
||||
import org.whispersystems.util.Base64;
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -27,6 +31,9 @@ import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
|
|||
|
||||
public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
final static Logger logger = LoggerFactory.getLogger(ReceiveCommand.class);
|
||||
|
||||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.addArgument("-t", "--timeout")
|
||||
|
@ -45,6 +52,11 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
|||
|
||||
boolean inJson = ns.getString("output").equals("json") || ns.getBoolean("json");
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
if (ns.getBoolean("json")) {
|
||||
logger.warn("\"--json\" option has been deprecated, please use \"output\" instead.");
|
||||
}
|
||||
|
||||
if (inJson) {
|
||||
jsonProcessor = new ObjectMapper();
|
||||
jsonProcessor.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
|
@ -151,6 +163,11 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
|||
public int handleCommand(final Namespace ns, final Manager m) {
|
||||
boolean inJson = ns.getString("output").equals("json") || ns.getBoolean("json");
|
||||
|
||||
// TODO delete later when "json" variable is removed
|
||||
if (ns.getBoolean("json")) {
|
||||
logger.warn("\"--json\" option has been deprecated, please use \"output\" instead.");
|
||||
}
|
||||
|
||||
double timeout = 5;
|
||||
if (ns.getDouble("timeout") != null) {
|
||||
timeout = ns.getDouble("timeout");
|
||||
|
|
|
@ -340,7 +340,7 @@ public class Manager implements Closeable {
|
|||
*
|
||||
* @param numbers The set of phone number in question
|
||||
* @return A map of numbers to booleans. True if registered, false otherwise. Should never be null
|
||||
* @throws IOException if its unable to check if the users are registered
|
||||
* @throws IOException if its unable to get the contacts to check if they're registered
|
||||
*/
|
||||
public Map<String, Boolean> areUsersRegistered(Set<String> numbers) throws IOException {
|
||||
// Note "contactDetails" has no optionals. It only gives us info on users who are registered
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue