mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 20:40:38 +00:00
Add blockContact and unblockContact subcommands
This commit is contained in:
parent
3b2682a57a
commit
7f0ce68ec1
7 changed files with 97 additions and 1 deletions
|
@ -686,6 +686,36 @@ public class Manager implements Signal {
|
|||
account.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockContact(String number) {
|
||||
ContactInfo contact = account.getContactStore().getContact(number);
|
||||
if (contact == null) {
|
||||
contact = new ContactInfo();
|
||||
contact.number = number;
|
||||
System.err.println("Adding and blocking contact " + number);
|
||||
} else {
|
||||
System.err.println("Blocking contact " + number);
|
||||
}
|
||||
contact.blocked = true;
|
||||
account.getContactStore().updateContact(contact);
|
||||
account.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unblockContact(String number) {
|
||||
ContactInfo contact = account.getContactStore().getContact(number);
|
||||
if (contact == null) {
|
||||
contact = new ContactInfo();
|
||||
contact.number = number;
|
||||
System.err.println("Adding and unblocking contact " + number);
|
||||
} else {
|
||||
System.err.println("Unblocking contact " + number);
|
||||
}
|
||||
contact.blocked = false;
|
||||
account.getContactStore().updateContact(contact);
|
||||
account.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<byte[]> getGroupIds() {
|
||||
List<GroupInfo> groups = getGroups();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue