mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 16:59:21 +00:00
Avoid to register with an unactivated account.
This commit is contained in:
parent
610c9a0453
commit
3e1e1a1739
3 changed files with 17 additions and 12 deletions
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Blinking on resize or Ui updates on screen that have low frame rates.
|
||||
- Timezones and Windows fix.
|
||||
- Download the correct version of openH264 (2.2.0)
|
||||
- Avoid to register the account while activating it.
|
||||
- Update SDK to 5.3.80
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -52,17 +52,18 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void createAccount (const shared_ptr<linphone::AccountCreator> &creator) {
|
||||
auto account = creator->createAccountInCore();
|
||||
if(account){
|
||||
void createAccount (const shared_ptr<linphone::AccountCreator> &creator, bool enableRegister = false) {
|
||||
if(!mAssistant->mAccount) mAssistant->mAccount = creator->createAccountInCore();
|
||||
if(mAssistant->mAccount){
|
||||
AccountSettingsModel *accountSettingsModel = CoreManager::getInstance()->getAccountSettingsModel();
|
||||
CoreManager::getInstance()->addingAccount(account->getParams());
|
||||
auto accountParams = account->getParams()->clone();
|
||||
CoreManager::getInstance()->addingAccount(mAssistant->mAccount->getParams());
|
||||
auto accountParams = mAssistant->mAccount->getParams()->clone();
|
||||
auto natPolicy = accountParams->getNatPolicy();
|
||||
if(natPolicy)
|
||||
accountParams->setNatPolicy(natPolicy->clone());// Be sure to have a 'ref' entry on a nat_policy. When using default values, the 'ref' entry is lost where it should be pointing to default. We get one by cloning the policy.
|
||||
if (accountSettingsModel->addOrUpdateAccount(account, accountParams)) {
|
||||
accountSettingsModel->setDefaultAccount(account);
|
||||
accountParams->enableRegister(enableRegister);
|
||||
if (accountSettingsModel->addOrUpdateAccount(mAssistant->mAccount, accountParams)) {
|
||||
accountSettingsModel->setDefaultAccount(mAssistant->mAccount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +128,7 @@ private:
|
|||
creator->recoverAccount();
|
||||
}else{
|
||||
emit mAssistant->loginStatusChanged("");
|
||||
createAccount(creator);
|
||||
createAccount(creator, true);
|
||||
CoreManager::getInstance()->getSipAddressesModel()->reset();
|
||||
mAssistant->setIsProcessing(false);
|
||||
}
|
||||
|
|
@ -176,7 +177,7 @@ private:
|
|||
creator->recoverAccount();
|
||||
}else{
|
||||
emit mAssistant->loginStatusChanged("");
|
||||
createAccount(creator);
|
||||
createAccount(creator, true);
|
||||
CoreManager::getInstance()->getSipAddressesModel()->reset();
|
||||
mAssistant->setIsProcessing(false);
|
||||
}
|
||||
|
|
@ -262,8 +263,9 @@ private:
|
|||
status == linphone::AccountCreator::Status::AccountAlreadyActivated
|
||||
) {
|
||||
if (creator->getEmail().empty())
|
||||
createAccount(creator);
|
||||
createAccount(creator, true);
|
||||
CoreManager::getInstance()->getSipAddressesModel()->reset();
|
||||
|
||||
emit mAssistant->activateStatusChanged(QString(""));
|
||||
} else {
|
||||
if (status == linphone::AccountCreator::Status::RequestFailed)
|
||||
|
|
@ -279,7 +281,7 @@ private:
|
|||
const string &
|
||||
) override {
|
||||
if (status == linphone::AccountCreator::Status::AccountActivated) {
|
||||
createAccount(creator);
|
||||
createAccount(creator, true);
|
||||
CoreManager::getInstance()->getSipAddressesModel()->reset();
|
||||
emit mAssistant->activateStatusChanged(QString(""));
|
||||
} else {
|
||||
|
|
@ -313,7 +315,7 @@ private:
|
|||
linphone::AccountCreator::Status status,
|
||||
const std::string & response) override {
|
||||
if( status == linphone::AccountCreator::Status::RequestOk){
|
||||
createAccount(creator);
|
||||
createAccount(creator, true);
|
||||
CoreManager::getInstance()->getSipAddressesModel()->reset();
|
||||
emit mAssistant->activateStatusChanged("");
|
||||
} else {
|
||||
|
|
@ -366,6 +368,7 @@ void AssistantModel::activate () {
|
|||
void AssistantModel::create () {
|
||||
setIsProcessing(true);
|
||||
mNextAction = AccountCreation;
|
||||
mAccount = nullptr;
|
||||
if(mAccountCreator->getUsername().empty())
|
||||
mAccountCreator->setUsername(mAccountCreator->getPhoneNumber());
|
||||
emit createStatusChanged(tr("requestingValidationUrl"));
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ private:
|
|||
|
||||
|
||||
std::shared_ptr<linphone::AccountCreator> mAccountCreator;
|
||||
std::shared_ptr<linphone::Account> mAccount;
|
||||
std::shared_ptr<Handlers> mHandlers;
|
||||
#ifdef ENABLE_OAUTH2
|
||||
OAuth2Model * oAuth2Model = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue