]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java
Store information if account is registerd on LIVE or STAGING env in account file
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / ProvisioningManagerImpl.java
index 7519950e28c17694fa7d7c2fb25d0ab5cbbcbebb..7d396bb1e2b34dea9b38ef8b5d10cb50b8afbf05 100644 (file)
@@ -136,6 +136,7 @@ class ProvisioningManagerImpl implements ProvisioningManager {
             account = SignalAccount.createOrUpdateLinkedAccount(pathConfig.dataPath(),
                     accountPath,
                     number,
+                    serviceEnvironmentConfig.getType(),
                     aci,
                     pni,
                     password,
@@ -209,6 +210,13 @@ class ProvisioningManagerImpl implements ProvisioningManager {
                 logger.debug("Account is a master device.");
                 return false;
             }
+            if (signalAccount.isRegistered()
+                    && signalAccount.getServiceEnvironment() != null
+                    && signalAccount.getServiceEnvironment() != serviceEnvironmentConfig.getType()) {
+                logger.debug("Account is registered in another environment: {}.",
+                        signalAccount.getServiceEnvironment());
+                return false;
+            }
 
             final var m = new ManagerImpl(signalAccount,
                     pathConfig,