]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/UnblockCommand.java
Implement sending mentions
[signal-cli] / src / main / java / org / asamk / signal / commands / UnblockCommand.java
index 46bd9daabb0afb8c37efbda22234d435828d04b1..53eab3b3b728d5b69bfaee45c8022bb7f213504c 100644 (file)
@@ -36,13 +36,14 @@ public class UnblockCommand implements JsonRpcLocalCommand {
     public void handleCommand(
             final Namespace ns, final Manager m, final OutputWriter outputWriter
     ) throws CommandException {
     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) {
             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);
         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) {
             } 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);
             }
         }
     }
             }
         }
     }