X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/8bc6c0abcbdc70b1049df08712cdeff046f48f5e..53b84bad0280694a19e47d6f76620f8a140fdd15:/src/main/java/org/asamk/signal/commands/UnblockCommand.java diff --git a/src/main/java/org/asamk/signal/commands/UnblockCommand.java b/src/main/java/org/asamk/signal/commands/UnblockCommand.java index 46bd9daa..53eab3b3 100644 --- a/src/main/java/org/asamk/signal/commands/UnblockCommand.java +++ b/src/main/java/org/asamk/signal/commands/UnblockCommand.java @@ -36,13 +36,14 @@ public class UnblockCommand implements JsonRpcLocalCommand { public void handleCommand( final Namespace ns, final Manager m, final OutputWriter outputWriter ) throws CommandException { - for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("recipient"), m.getUsername())) { + for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("recipient"), + m.getSelfNumber())) { try { m.setContactBlocked(contactNumber, false); } catch (NotMasterDeviceException e) { throw new UserErrorException("This command doesn't work on linked devices."); } catch (IOException e) { - throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage()); + throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage(), e); } } @@ -50,10 +51,12 @@ public class UnblockCommand implements JsonRpcLocalCommand { for (var groupId : CommandUtil.getGroupIds(groupIdStrings)) { try { m.setGroupBlocked(groupId, false); + } catch (NotMasterDeviceException e) { + throw new UserErrorException("This command doesn't work on linked devices."); } catch (GroupNotFoundException e) { logger.warn("Unknown group id: {}", groupId); } catch (IOException e) { - throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage()); + throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage(), e); } } }