mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add --hide parameter to removeContact command
This commit is contained in:
parent
9f4a2b3e26
commit
7b0744ec75
14 changed files with 96 additions and 35 deletions
|
@ -20,7 +20,11 @@ public class RemoveContactCommand implements JsonRpcLocalCommand {
|
|||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Remove the details of a given contact");
|
||||
subparser.addArgument("recipient").help("Contact number");
|
||||
subparser.addArgument("--forget")
|
||||
final var mut = subparser.addMutuallyExclusiveGroup();
|
||||
mut.addArgument("--hide")
|
||||
.action(Arguments.storeTrue())
|
||||
.help("Hide the contact in the contact list, but keep the data.");
|
||||
mut.addArgument("--forget")
|
||||
.action(Arguments.storeTrue())
|
||||
.help("Delete all data associated with this contact, including identity keys and sessions.");
|
||||
}
|
||||
|
@ -32,8 +36,11 @@ public class RemoveContactCommand implements JsonRpcLocalCommand {
|
|||
var recipientString = ns.getString("recipient");
|
||||
var recipient = CommandUtil.getSingleRecipientIdentifier(recipientString, m.getSelfNumber());
|
||||
|
||||
var hide = Boolean.TRUE == ns.getBoolean("hide");
|
||||
var forget = Boolean.TRUE == ns.getBoolean("forget");
|
||||
if (forget) {
|
||||
if (hide) {
|
||||
m.hideRecipient(recipient);
|
||||
} else if (forget) {
|
||||
m.deleteRecipient(recipient);
|
||||
} else {
|
||||
m.deleteContact(recipient);
|
||||
|
|
|
@ -452,6 +452,10 @@ public class DbusManagerImpl implements Manager {
|
|||
return new SendMessageResults(0, Map.of());
|
||||
}
|
||||
|
||||
public void hideRecipient(final RecipientIdentifier.Single recipient) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipient(final RecipientIdentifier.Single recipient) {
|
||||
signal.deleteRecipient(recipient.getIdentifier());
|
||||
|
@ -653,7 +657,7 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
return Recipient.newBuilder()
|
||||
.withAddress(new RecipientAddress(null, n))
|
||||
.withContact(new Contact(contactName, null, null, 0, contactBlocked, false, false))
|
||||
.withContact(new Contact(contactName, null, null, 0, contactBlocked, false, false, false))
|
||||
.build();
|
||||
}).filter(Objects::nonNull).toList();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue