@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Block the given contacts or groups (no messages will be received)");
- subparser.addArgument("contact").help("Contact number").nargs("*");
+ subparser.addArgument("recipient").help("Contact number").nargs("*");
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
}
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- final var contacts = ns.<String>getList("contact");
+ final var contacts = ns.<String>getList("recipient");
for (var contact : CommandUtil.getSingleRecipientIdentifiers(contacts, m.getUsername())) {
try {
m.setContactBlocked(contact, true);
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Check if the specified phone number/s have been registered");
- subparser.addArgument("number").help("Phone number").nargs("+");
+ subparser.addArgument("recipient").help("Phone number").nargs("+");
}
@Override
// Get a map of registration statuses
Map<String, Pair<String, UUID>> registered;
try {
- registered = m.areUsersRegistered(new HashSet<>(ns.getList("number")));
+ registered = m.areUsersRegistered(new HashSet<>(ns.getList("recipient")));
} catch (IOException e) {
logger.debug("Failed to check registered users", e);
throw new IOErrorException("Unable to check if users are registered");
private static final class JsonUserStatus {
- public final String name;
+ public final String recipient;
public final String number;
public final boolean isRegistered;
- public JsonUserStatus(String name, String number, String uuid, boolean isRegistered) {
- this.name = name;
+ public JsonUserStatus(String recipient, String number, String uuid, boolean isRegistered) {
+ this.recipient = recipient;
this.number = number;
this.uuid = uuid;
this.isRegistered = isRegistered;
.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
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);
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Set the trust level of a given number.");
- subparser.addArgument("number").help("Specify the phone number, for which to set the trust.").required(true);
+ subparser.addArgument("recipient").help("Specify the phone number, for which to set the trust.").required(true);
var mutTrust = subparser.addMutuallyExclusiveGroup();
mutTrust.addArgument("-a", "--trust-all-known-keys")
.help("Trust all known keys of this user, only use this for testing.")
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- var recipentString = ns.getString("number");
+ var recipentString = ns.getString("recipient");
var recipient = CommandUtil.getSingleRecipientIdentifier(recipentString, m.getUsername());
if (ns.getBoolean("trust-all-known-keys")) {
boolean res = m.trustIdentityAllKeys(recipient);
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Unblock the given contacts or groups (messages will be received again)");
- subparser.addArgument("contact").help("Contact number").nargs("*");
+ subparser.addArgument("recipient").help("Contact number").nargs("*");
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
}
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("contact"), m.getUsername())) {
+ for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("recipient"), m.getUsername())) {
try {
m.setContactBlocked(contactNumber, false);
} catch (NotMasterDeviceException e) {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Update the details of a given contact");
- subparser.addArgument("number").help("Contact number");
+ subparser.addArgument("recipient").help("Contact number");
subparser.addArgument("-n", "--name").help("New contact name");
subparser.addArgument("-e", "--expiration").type(int.class).help("Set expiration time of messages (seconds)");
}
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- var recipientString = ns.getString("number");
+ var recipientString = ns.getString("recipient");
var recipient = CommandUtil.getSingleRecipientIdentifier(recipientString, m.getUsername());
try {