X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/22add1cbee357e988ca9c85d9d161fc783fd5fa3..6843643aad90a6ba6380e297411f8b6e487946e1:/lib/src/main/java/org/asamk/signal/manager/RegistrationManagerImpl.java diff --git a/lib/src/main/java/org/asamk/signal/manager/RegistrationManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/RegistrationManagerImpl.java index 3529154a..337aa348 100644 --- a/lib/src/main/java/org/asamk/signal/manager/RegistrationManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/RegistrationManagerImpl.java @@ -18,7 +18,9 @@ package org.asamk.signal.manager; import org.asamk.signal.manager.api.CaptchaRequiredException; import org.asamk.signal.manager.api.IncorrectPinException; +import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException; import org.asamk.signal.manager.api.PinLockedException; +import org.asamk.signal.manager.api.UpdateProfile; import org.asamk.signal.manager.config.ServiceConfig; import org.asamk.signal.manager.config.ServiceEnvironmentConfig; import org.asamk.signal.manager.helper.AccountFileUpdater; @@ -94,7 +96,9 @@ class RegistrationManagerImpl implements RegistrationManager { } @Override - public void register(boolean voiceVerification, String captcha) throws IOException, CaptchaRequiredException { + public void register( + boolean voiceVerification, String captcha + ) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException { if (account.isRegistered() && account.getServiceEnvironment() != null && account.getServiceEnvironment() != serviceEnvironmentConfig.getType()) { @@ -139,7 +143,7 @@ class RegistrationManagerImpl implements RegistrationManager { } // Set an initial empty profile so user can be added to groups try { - m.setProfile(null, null, null, null, null); + m.updateProfile(UpdateProfile.newBuilder().build()); } catch (NoClassDefFoundError e) { logger.warn("Failed to set default profile: {}", e.getMessage()); } @@ -178,12 +182,13 @@ class RegistrationManagerImpl implements RegistrationManager { account.getLocalRegistrationId(), true, null, - account.getPinMasterKey() == null ? null : account.getPinMasterKey().deriveRegistrationLock(), + account.getRegistrationLock(), account.getSelfUnidentifiedAccessKey(), account.isUnrestrictedUnidentifiedAccess(), capabilities, account.isDiscoverableByPhoneNumber(), - account.getEncryptedDeviceName()); + account.getEncryptedDeviceName(), + account.getLocalPniRegistrationId()); account.setRegistered(true); logger.info("Reactivated existing account, verify is not necessary."); if (newManagerListener != null) { @@ -212,7 +217,8 @@ class RegistrationManagerImpl implements RegistrationManager { account.getSelfUnidentifiedAccessKey(), account.isUnrestrictedUnidentifiedAccess(), ServiceConfig.capabilities, - account.isDiscoverableByPhoneNumber()); + account.isDiscoverableByPhoneNumber(), + account.getLocalPniRegistrationId()); } else { return accountManager.verifyAccountWithRegistrationLockPin(verificationCode, account.getLocalRegistrationId(), @@ -221,7 +227,8 @@ class RegistrationManagerImpl implements RegistrationManager { account.getSelfUnidentifiedAccessKey(), account.isUnrestrictedUnidentifiedAccess(), ServiceConfig.capabilities, - account.isDiscoverableByPhoneNumber()); + account.isDiscoverableByPhoneNumber(), + account.getLocalPniRegistrationId()); } }