]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Make version command work on the command line
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index ec7174b23abf3c4a43358cc326ed569551993297..d2ac27a987254b699703028489e0ee70af1412cc 100644 (file)
@@ -9,7 +9,7 @@ import org.asamk.signal.manager.api.InvalidDeviceLinkException;
 import org.asamk.signal.manager.api.InvalidNumberException;
 import org.asamk.signal.manager.api.InvalidStickerException;
 import org.asamk.signal.manager.api.Message;
-import org.asamk.signal.manager.api.NotMasterDeviceException;
+import org.asamk.signal.manager.api.NotPrimaryDeviceException;
 import org.asamk.signal.manager.api.RecipientIdentifier;
 import org.asamk.signal.manager.api.SendMessageResult;
 import org.asamk.signal.manager.api.SendMessageResults;
@@ -216,7 +216,8 @@ public class DbusSignalImpl implements Signal {
                             attachments,
                             List.of(),
                             Optional.empty(),
-                            Optional.empty()),
+                            Optional.empty(),
+                            List.of()),
                     getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream()
                             .map(RecipientIdentifier.class::cast)
                             .collect(Collectors.toSet()));
@@ -367,7 +368,8 @@ public class DbusSignalImpl implements Signal {
                     attachments,
                     List.of(),
                     Optional.empty(),
-                    Optional.empty()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE));
+                    Optional.empty(),
+                    List.of()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE));
             checkSendMessageResults(results);
             return results.timestamp();
         } catch (AttachmentInvalidException e) {
@@ -408,7 +410,8 @@ public class DbusSignalImpl implements Signal {
                     attachments,
                     List.of(),
                     Optional.empty(),
-                    Optional.empty()), Set.of(getGroupRecipientIdentifier(groupId)));
+                    Optional.empty(),
+                    List.of()), Set.of(getGroupRecipientIdentifier(groupId)));
             checkSendMessageResults(results);
             return results.timestamp();
         } catch (IOException | InvalidStickerException e) {
@@ -489,8 +492,8 @@ public class DbusSignalImpl implements Signal {
     @Override
     public void setContactName(final String number, final String name) {
         try {
-            m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name);
-        } catch (NotMasterDeviceException e) {
+            m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, "");
+        } catch (NotPrimaryDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
         } catch (IOException e) {
             throw new Error.Failure("Contact is not registered.");
@@ -514,7 +517,7 @@ public class DbusSignalImpl implements Signal {
     public void setContactBlocked(final String number, final boolean blocked) {
         try {
             m.setContactsBlocked(List.of(getSingleRecipientIdentifier(number, m.getSelfNumber())), blocked);
-        } catch (NotMasterDeviceException e) {
+        } catch (NotPrimaryDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
@@ -527,7 +530,7 @@ public class DbusSignalImpl implements Signal {
     public void setGroupBlocked(final byte[] groupId, final boolean blocked) {
         try {
             m.setGroupsBlocked(List.of(getGroupId(groupId)), blocked);
-        } catch (NotMasterDeviceException e) {
+        } catch (NotPrimaryDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
         } catch (GroupNotFoundException e) {
             throw new Error.GroupNotFound(e.getMessage());
@@ -694,7 +697,7 @@ public class DbusSignalImpl implements Signal {
             m.setRegistrationLockPin(Optional.empty());
         } catch (IOException e) {
             throw new Error.Failure("Remove pin error: " + e.getMessage());
-        } catch (NotMasterDeviceException e) {
+        } catch (NotPrimaryDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
         }
     }
@@ -705,7 +708,7 @@ public class DbusSignalImpl implements Signal {
             m.setRegistrationLockPin(Optional.of(registrationLockPin));
         } catch (IOException e) {
             throw new Error.Failure("Set pin error: " + e.getMessage());
-        } catch (NotMasterDeviceException e) {
+        } catch (NotPrimaryDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
         }
     }
@@ -1092,7 +1095,7 @@ public class DbusSignalImpl implements Signal {
                         Optional.ofNullable(linkPreviews)));
             } catch (IOException e) {
                 throw new Error.Failure("UpdateAccount error: " + e.getMessage());
-            } catch (NotMasterDeviceException e) {
+            } catch (NotPrimaryDeviceException e) {
                 throw new Error.Failure("This command doesn't work on linked devices.");
             }
         }
@@ -1270,7 +1273,7 @@ public class DbusSignalImpl implements Signal {
         private void setIsBlocked(final boolean isBlocked) {
             try {
                 m.setGroupsBlocked(List.of(groupId), isBlocked);
-            } catch (NotMasterDeviceException e) {
+            } catch (NotPrimaryDeviceException e) {
                 throw new Error.Failure("This command doesn't work on linked devices.");
             } catch (GroupNotFoundException e) {
                 throw new Error.GroupNotFound(e.getMessage());