]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Update libsignal-service-java
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index c5be7501dbca99b7acb09cb2f081e5e35d1024c9..0bb0c43534c33cab1b1101322da8b7dc8e4af2a1 100644 (file)
@@ -10,6 +10,7 @@ import org.asamk.signal.manager.api.RecipientIdentifier;
 import org.asamk.signal.manager.groups.GroupId;
 import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
 import org.asamk.signal.manager.groups.GroupNotFoundException;
+import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
 import org.asamk.signal.manager.groups.LastGroupAdminException;
 import org.asamk.signal.manager.groups.NotAGroupMemberException;
 import org.asamk.signal.manager.storage.identities.IdentityInfo;
@@ -20,6 +21,7 @@ import org.whispersystems.libsignal.util.Pair;
 import org.whispersystems.libsignal.util.guava.Optional;
 import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException;
 import org.whispersystems.signalservice.api.messages.SendMessageResult;
+import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
 import org.whispersystems.signalservice.api.util.InvalidNumberException;
 
 import java.io.File;
@@ -77,7 +79,7 @@ public class DbusSignalImpl implements Signal {
             throw new Error.AttachmentInvalid(e.getMessage());
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -104,7 +106,7 @@ public class DbusSignalImpl implements Signal {
             return results.getTimestamp();
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -120,7 +122,7 @@ public class DbusSignalImpl implements Signal {
             return results.getTimestamp();
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -158,7 +160,7 @@ public class DbusSignalImpl implements Signal {
             return results.getTimestamp();
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -176,7 +178,7 @@ public class DbusSignalImpl implements Signal {
             throw new Error.AttachmentInvalid(e.getMessage());
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -200,7 +202,7 @@ public class DbusSignalImpl implements Signal {
             return results.getTimestamp();
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         } catch (AttachmentInvalidException e) {
             throw new Error.AttachmentInvalid(e.getMessage());
@@ -225,7 +227,7 @@ public class DbusSignalImpl implements Signal {
             return results.getTimestamp();
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         }
     }
@@ -243,6 +245,8 @@ public class DbusSignalImpl implements Signal {
             m.setContactName(getSingleRecipientIdentifier(number, m.getUsername()), name);
         } catch (NotMasterDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
+        } catch (UnregisteredUserException e) {
+            throw new Error.Failure("Contact is not registered.");
         }
     }
 
@@ -252,6 +256,8 @@ public class DbusSignalImpl implements Signal {
             m.setContactBlocked(getSingleRecipientIdentifier(number, m.getUsername()), blocked);
         } catch (NotMasterDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
+        } catch (IOException e) {
+            throw new Error.Failure(e.getMessage());
         }
     }
 
@@ -261,6 +267,8 @@ public class DbusSignalImpl implements Signal {
             m.setGroupBlocked(getGroupId(groupId), blocked);
         } catch (GroupNotFoundException e) {
             throw new Error.GroupNotFound(e.getMessage());
+        } catch (IOException e) {
+            throw new Error.Failure(e.getMessage());
         }
     }
 
@@ -337,7 +345,7 @@ public class DbusSignalImpl implements Signal {
             }
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new Error.GroupNotFound(e.getMessage());
         } catch (AttachmentInvalidException e) {
             throw new Error.AttachmentInvalid(e.getMessage());
@@ -419,7 +427,7 @@ public class DbusSignalImpl implements Signal {
     public void quitGroup(final byte[] groupId) {
         var group = getGroupId(groupId);
         try {
-            m.sendQuitGroupMessage(group, Set.of());
+            m.quitGroup(group, Set.of());
         } catch (GroupNotFoundException | NotAGroupMemberException e) {
             throw new Error.GroupNotFound(e.getMessage());
         } catch (IOException | LastGroupAdminException e) {