X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/2d60f98e933843ad339ac42ae20a33014a76ee0e..53f47d42fc30a86a9bb6cd08f4678a756f4a4aaf:/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java diff --git a/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java index db8744cd..f6205dba 100644 --- a/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java @@ -79,6 +79,7 @@ import java.io.IOException; import java.net.URI; import java.time.Duration; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -683,25 +684,36 @@ class ManagerImpl implements Manager { } @Override - public void setContactBlocked( - RecipientIdentifier.Single recipient, boolean blocked + public void setContactsBlocked( + Collection recipients, boolean blocked ) throws NotMasterDeviceException, IOException, UnregisteredRecipientException { if (!account.isMasterDevice()) { throw new NotMasterDeviceException(); } - context.getContactHelper().setContactBlocked(context.getRecipientHelper().resolveRecipient(recipient), blocked); + if (recipients.size() == 0) { + return; + } + final var recipientIds = context.getRecipientHelper().resolveRecipients(recipients); + for (final var recipientId : recipientIds) { + context.getContactHelper().setContactBlocked(recipientId, blocked); + } // TODO cycle our profile key, if we're not together in a group with recipient context.getSyncHelper().sendBlockedList(); } @Override - public void setGroupBlocked( - final GroupId groupId, final boolean blocked + public void setGroupsBlocked( + final Collection groupIds, final boolean blocked ) throws GroupNotFoundException, NotMasterDeviceException { if (!account.isMasterDevice()) { throw new NotMasterDeviceException(); } - context.getGroupHelper().setGroupBlocked(groupId, blocked); + if (groupIds.size() == 0) { + return; + } + for (final var groupId : groupIds) { + context.getGroupHelper().setGroupBlocked(groupId, blocked); + } // TODO cycle our profile key context.getSyncHelper().sendBlockedList(); }