1 package org
.asamk
.signal
.commands
;
3 import net
.sourceforge
.argparse4j
.impl
.Arguments
;
4 import net
.sourceforge
.argparse4j
.inf
.Namespace
;
5 import net
.sourceforge
.argparse4j
.inf
.Subparser
;
7 import org
.asamk
.signal
.commands
.exceptions
.CommandException
;
8 import org
.asamk
.signal
.manager
.Manager
;
9 import org
.asamk
.signal
.output
.OutputWriter
;
10 import org
.asamk
.signal
.util
.CommandUtil
;
12 public class RemoveContactCommand
implements JsonRpcLocalCommand
{
15 public String
getName() {
16 return "removeContact";
20 public void attachToSubparser(final Subparser subparser
) {
21 subparser
.help("Remove the details of a given contact");
22 subparser
.addArgument("recipient").help("Contact number");
23 subparser
.addArgument("--forget")
24 .action(Arguments
.storeTrue())
25 .help("Delete all data associated with this contact, including identity keys and sessions.");
29 public void handleCommand(
30 final Namespace ns
, final Manager m
, final OutputWriter outputWriter
31 ) throws CommandException
{
32 var recipientString
= ns
.getString("recipient");
33 var recipient
= CommandUtil
.getSingleRecipientIdentifier(recipientString
, m
.getSelfNumber());
35 var forget
= Boolean
.TRUE
== ns
.getBoolean("forget");
37 m
.deleteRecipient(recipient
);
39 m
.deleteContact(recipient
);