Add blockContact and unblockContact subcommands

This commit is contained in:
Daniel Schäufele 2020-01-05 00:03:27 +01:00
parent 3b2682a57a
commit 7f0ce68ec1
7 changed files with 97 additions and 1 deletions

View file

@ -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();