]> nmode's Git Repositories - signal-cli/commitdiff
Replace UnregisteredUserException
authorAsamK <asamk@gmx.de>
Sun, 31 Oct 2021 19:43:29 +0000 (20:43 +0100)
committerAsamK <asamk@gmx.de>
Sun, 31 Oct 2021 19:43:29 +0000 (20:43 +0100)
lib/src/main/java/org/asamk/signal/manager/Manager.java
lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java
src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java

index c7131d394056ac395761e2ee3f5c718b065045ef..330a83f445af4763999be8d0728c74b43fa1a00c 100644 (file)
@@ -29,7 +29,6 @@ import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemo
 import org.whispersystems.signalservice.api.messages.SignalServiceContent;
 import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
-import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
 import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
 import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
 
@@ -121,7 +120,7 @@ public interface Manager extends Closeable {
 
     void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException;
 
-    Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws UnregisteredUserException;
+    Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException;
 
     List<Group> getGroups();
 
@@ -175,7 +174,7 @@ public interface Manager extends Closeable {
 
     void setContactName(
             RecipientIdentifier.Single recipient, String name
-    ) throws NotMasterDeviceException, UnregisteredUserException;
+    ) throws NotMasterDeviceException, IOException;
 
     void setContactBlocked(
             RecipientIdentifier.Single recipient, boolean blocked
index bbef8a069378e20e6d36a7bbc4c32923ba9dbc56..022915a769228d44d45196ecfb77fab31376b89e 100644 (file)
@@ -76,7 +76,6 @@ import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
 import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
 import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
-import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
 import org.whispersystems.signalservice.api.util.DeviceNameUtil;
 import org.whispersystems.signalservice.api.util.InvalidNumberException;
 import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
@@ -479,7 +478,7 @@ public class ManagerImpl implements Manager {
     }
 
     @Override
-    public Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws UnregisteredUserException {
+    public Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException {
         return profileHelper.getRecipientProfile(resolveRecipient(recipient));
     }
 
@@ -706,7 +705,7 @@ public class ManagerImpl implements Manager {
     @Override
     public void setContactName(
             RecipientIdentifier.Single recipient, String name
-    ) throws NotMasterDeviceException, UnregisteredUserException {
+    ) throws NotMasterDeviceException, IOException {
         if (!account.isMasterDevice()) {
             throw new NotMasterDeviceException();
         }
@@ -813,11 +812,11 @@ public class ManagerImpl implements Manager {
         try {
             uuidMap = getRegisteredUsers(Set.of(number));
         } catch (NumberFormatException e) {
-            throw new UnregisteredUserException(number, e);
+            throw new IOException(number, e);
         }
         final var uuid = uuidMap.get(number);
         if (uuid == null) {
-            throw new UnregisteredUserException(number, null);
+            throw new IOException(number, null);
         }
         return uuid;
     }
@@ -1134,7 +1133,7 @@ public class ManagerImpl implements Manager {
         final RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return false;
         }
         return contactHelper.isContactBlocked(recipientId);
@@ -1164,7 +1163,7 @@ public class ManagerImpl implements Manager {
         final RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return null;
         }
 
@@ -1220,7 +1219,7 @@ public class ManagerImpl implements Manager {
         IdentityInfo identity;
         try {
             identity = account.getIdentityKeyStore().getIdentity(resolveRecipient(recipient));
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             identity = null;
         }
         return identity == null ? List.of() : List.of(toIdentity(identity));
@@ -1237,7 +1236,7 @@ public class ManagerImpl implements Manager {
         RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return false;
         }
         return identityHelper.trustIdentityVerified(recipientId, fingerprint);
@@ -1254,7 +1253,7 @@ public class ManagerImpl implements Manager {
         RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return false;
         }
         return identityHelper.trustIdentityVerifiedSafetyNumber(recipientId, safetyNumber);
@@ -1271,7 +1270,7 @@ public class ManagerImpl implements Manager {
         RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return false;
         }
         return identityHelper.trustIdentityVerifiedSafetyNumber(recipientId, safetyNumber);
@@ -1287,7 +1286,7 @@ public class ManagerImpl implements Manager {
         RecipientId recipientId;
         try {
             recipientId = resolveRecipient(recipient);
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             return false;
         }
         return identityHelper.trustIdentityAllKeys(recipientId);
@@ -1324,7 +1323,7 @@ public class ManagerImpl implements Manager {
         return resolveSignalServiceAddress(account.getRecipientStore().resolveRecipient(uuid));
     }
 
-    private Set<RecipientId> resolveRecipients(Collection<RecipientIdentifier.Single> recipients) throws UnregisteredUserException {
+    private Set<RecipientId> resolveRecipients(Collection<RecipientIdentifier.Single> recipients) throws IOException {
         final var recipientIds = new HashSet<RecipientId>(recipients.size());
         for (var number : recipients) {
             final var recipientId = resolveRecipient(number);
@@ -1333,7 +1332,7 @@ public class ManagerImpl implements Manager {
         return recipientIds;
     }
 
-    private RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws UnregisteredUserException {
+    private RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws IOException {
         if (recipient instanceof RecipientIdentifier.Uuid) {
             return account.getRecipientStore().resolveRecipient(((RecipientIdentifier.Uuid) recipient).uuid);
         } else {
index 07be4b3e7f8976242cb11c934877961a27efcb70..281877710678abcea505b5307794b639a3c07c23 100644 (file)
@@ -33,7 +33,6 @@ import org.freedesktop.dbus.exceptions.DBusException;
 import org.freedesktop.dbus.exceptions.DBusExecutionException;
 import org.freedesktop.dbus.types.Variant;
 import org.whispersystems.signalservice.api.messages.SendMessageResult;
-import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
 import org.whispersystems.signalservice.api.util.InvalidNumberException;
 import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
 
@@ -390,7 +389,7 @@ public class DbusSignalImpl implements Signal {
             m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name);
         } catch (NotMasterDeviceException e) {
             throw new Error.Failure("This command doesn't work on linked devices.");
-        } catch (UnregisteredUserException e) {
+        } catch (IOException e) {
             throw new Error.Failure("Contact is not registered.");
         }
     }
@@ -639,7 +638,7 @@ public class DbusSignalImpl implements Signal {
                 Profile profile = null;
                 try {
                     profile = m.getRecipientProfile(RecipientIdentifier.Single.fromAddress(address));
-                } catch (UnregisteredUserException ignored) {
+                } catch (IOException ignored) {
                 }
                 if (profile != null && profile.getDisplayName().equals(name)) {
                     numbers.add(number);