mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 20:40:38 +00:00
Use only one method for blocking and unblocking
This commit is contained in:
parent
3a3d9545ea
commit
5ab3152a40
4 changed files with 7 additions and 24 deletions
|
@ -687,31 +687,16 @@ public class Manager implements Signal {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void blockContact(String number) {
|
||||
public void setContactBlocked(String number, boolean blocked) {
|
||||
ContactInfo contact = account.getContactStore().getContact(number);
|
||||
if (contact == null) {
|
||||
contact = new ContactInfo();
|
||||
contact.number = number;
|
||||
System.err.println("Adding and blocking contact " + number);
|
||||
System.err.println("Adding and " + (blocked ? "blocking" : "unblocking") + " contact " + number);
|
||||
} else {
|
||||
System.err.println("Blocking contact " + number);
|
||||
System.err.println((blocked ? "Blocking" : "Unblocking") + " 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;
|
||||
contact.blocked = blocked;
|
||||
account.getContactStore().updateContact(contact);
|
||||
account.save();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue