mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Set authinfo fort stun only if there is an username. It fixes the overwrite of AuthInfo that belongs to another item.
This commit is contained in:
parent
204ae3d5f9
commit
33b77dcdce
1 changed files with 26 additions and 22 deletions
|
|
@ -190,11 +190,13 @@ QVariantMap AccountSettingsModel::getAccountDescription (const shared_ptr<linpho
|
|||
accountParamsUpdated->setNatPolicy(natPolicy);
|
||||
account->setParams(accountParamsUpdated);
|
||||
}
|
||||
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = CoreManager::getInstance()->getCore()->findAuthInfo(
|
||||
if(turnUser != ""){
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = CoreManager::getInstance()->getCore()->findAuthInfo(
|
||||
"", turnUser, stunServer
|
||||
);
|
||||
map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString("");
|
||||
map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString("");
|
||||
}else
|
||||
map["turnPassword"] = "";
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
@ -367,25 +369,27 @@ bool AccountSettingsModel::addOrUpdateAccount(
|
|||
}
|
||||
accountParams->setNatPolicy(natPolicy);// TODO : We don't have an API to know if the current nat policy have a ref or not, so reset the natPolicy in all case. When we can hjave this info, put the set in the previous if-block
|
||||
|
||||
// Setting TURN auth info
|
||||
shared_ptr<linphone::Core> core(CoreManager::getInstance()->getCore());
|
||||
shared_ptr<const linphone::AuthInfo> authInfo(core->findAuthInfo("", turnUser, stunServer));
|
||||
if (authInfo) {
|
||||
shared_ptr<linphone::AuthInfo> clonedAuthInfo(authInfo->clone());
|
||||
clonedAuthInfo->setUserid(turnUser);
|
||||
clonedAuthInfo->setUsername(turnUser);
|
||||
clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString()));
|
||||
core->removeAuthInfo(authInfo);
|
||||
core->addAuthInfo(clonedAuthInfo);
|
||||
} else
|
||||
core->addAuthInfo(linphone::Factory::get()->createAuthInfo(
|
||||
turnUser,
|
||||
turnUser,
|
||||
Utils::appStringToCoreString(data["turnPassword"].toString()),
|
||||
"",
|
||||
stunServer,
|
||||
""
|
||||
));
|
||||
if( turnUser != ""){
|
||||
// Setting TURN auth info
|
||||
shared_ptr<linphone::Core> core(CoreManager::getInstance()->getCore());
|
||||
shared_ptr<const linphone::AuthInfo> authInfo(core->findAuthInfo("", turnUser, stunServer));
|
||||
if (authInfo) {
|
||||
shared_ptr<linphone::AuthInfo> clonedAuthInfo(authInfo->clone());
|
||||
clonedAuthInfo->setUserid(turnUser);
|
||||
clonedAuthInfo->setUsername(turnUser);
|
||||
clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString()));
|
||||
core->removeAuthInfo(authInfo);
|
||||
core->addAuthInfo(clonedAuthInfo);
|
||||
} else
|
||||
core->addAuthInfo(linphone::Factory::get()->createAuthInfo(
|
||||
turnUser,
|
||||
turnUser,
|
||||
Utils::appStringToCoreString(data["turnPassword"].toString()),
|
||||
"",
|
||||
stunServer,
|
||||
""
|
||||
));
|
||||
}
|
||||
if( newPublishPresence)
|
||||
emit publishPresenceChanged();
|
||||
return addOrUpdateAccount(account, accountParams);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue