X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/312c6c8bb2ace8d5e6ac35572834ece839682691..36475bb632316d0333f1c44f6639c4f63007bdce:/lib/src/main/java/org/asamk/signal/manager/Manager.java diff --git a/lib/src/main/java/org/asamk/signal/manager/Manager.java b/lib/src/main/java/org/asamk/signal/manager/Manager.java index 827d6d91..38f37ed2 100644 --- a/lib/src/main/java/org/asamk/signal/manager/Manager.java +++ b/lib/src/main/java/org/asamk/signal/manager/Manager.java @@ -1088,14 +1088,22 @@ public class Manager implements Closeable { return contact == null || contact.getName() == null ? "" : contact.getName(); } - public void setContactName(String number, String name) throws InvalidNumberException { + public void setContactName(String number, String name) throws InvalidNumberException, NotMasterDeviceException { + if (!account.isMasterDevice()) { + throw new NotMasterDeviceException(); + } final var recipientId = canonicalizeAndResolveRecipient(number); var contact = account.getContactStore().getContact(recipientId); final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact); account.getContactStore().storeContact(recipientId, builder.withName(name).build()); } - public void setContactBlocked(String number, boolean blocked) throws InvalidNumberException { + public void setContactBlocked( + String number, boolean blocked + ) throws InvalidNumberException, NotMasterDeviceException { + if (!account.isMasterDevice()) { + throw new NotMasterDeviceException(); + } setContactBlocked(canonicalizeAndResolveRecipient(number), blocked); }