]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/Manager.java
Add missing isActive check
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / Manager.java
index 87b89913ffd49f95fa07acc6861d9681c5df3498..c40fa7cdb2c2800f5f9d55323e5a30f9056d8521 100644 (file)
@@ -164,8 +164,7 @@ public class Manager implements Closeable {
                 return LEGACY_LOCK::unlock;
             }
         };
-        this.dependencies = new SignalDependencies(account.getSelfAddress(),
-                serviceEnvironmentConfig,
+        this.dependencies = new SignalDependencies(serviceEnvironmentConfig,
                 userAgent,
                 credentialsProvider,
                 account.getSignalProtocolStore(),
@@ -186,8 +185,6 @@ public class Manager implements Closeable {
                 avatarStore,
                 account.getProfileStore()::getProfileKey,
                 unidentifiedAccessHelper::getAccessFor,
-                dependencies::getProfileService,
-                dependencies::getMessageReceiver,
                 this::resolveSignalServiceAddress);
         final GroupV2Helper groupV2Helper = new GroupV2Helper(profileHelper::getRecipientProfileKeyCredential,
                 this::getRecipientProfile,
@@ -220,8 +217,7 @@ public class Manager implements Closeable {
                 this::resolveSignalServiceAddress);
 
         this.context = new Context(account,
-                dependencies.getAccountManager(),
-                dependencies.getMessageReceiver(),
+                dependencies,
                 stickerPackStore,
                 sendHelper,
                 groupHelper,
@@ -385,6 +381,13 @@ public class Manager implements Closeable {
     }
 
     public void deleteAccount() throws IOException {
+        try {
+            pinHelper.removeRegistrationLockPin();
+        } catch (UnauthenticatedResponseException e) {
+            logger.warn("Failed to remove registration lock pin");
+        }
+        account.setRegistrationLockPin(null, null);
+
         dependencies.getAccountManager().deleteAccount();
 
         account.setRegistered(false);
@@ -1142,10 +1145,6 @@ public class Manager implements Closeable {
     }
 
     public SignalServiceAddress resolveSignalServiceAddress(SignalServiceAddress address) {
-        if (address.matches(account.getSelfAddress())) {
-            return account.getSelfAddress();
-        }
-
         return resolveSignalServiceAddress(resolveRecipient(address));
     }