When adding a Linphone account, set core encryption to SRTP if None.

Fix encryption synchronization on QML.
This commit is contained in:
Julien Wadel 2022-09-29 15:44:27 +02:00
parent 8fcae64313
commit fd6fd27909
5 changed files with 15 additions and 4 deletions

View file

@ -48,6 +48,7 @@ private:
shared_ptr<linphone::ProxyConfig> proxyConfig = creator->createProxyConfig();
auto account = CoreManager::getInstance()->getCore()->getAccountByIdkey(proxyConfig->getIdkey());
if(account){
CoreManager::getInstance()->addingAccount(account->getParams());
CoreManager::getInstance()->getSettingsModel()->configureRlsUri(account);
CoreManager::getInstance()->getAccountSettingsModel()->setDefaultAccount(account);
}

View file

@ -291,6 +291,14 @@ void CoreManager::updateUserAgent(){
mCore->setUserAgent(Utils::appStringToCoreString(Utils::computeUserAgent(mCore->getConfig())), mCore->getVersion());
forceRefreshRegisters(); // After setting a new device name, REGISTER need to take account it.
}
void CoreManager::addingAccount(const std::shared_ptr<const linphone::AccountParams> params) {
if( params->getDomain() == Constants::LinphoneDomain) {// Special case for Linphone
// It has been decided that if the core encryption is None, new Linphone accounts will reset it to SRTP.
if( CoreManager::getInstance()->getSettingsModel()->getMediaEncryption() == SettingsModel::MediaEncryptionNone){
CoreManager::getInstance()->getSettingsModel()->setMediaEncryption(SettingsModel::MediaEncryptionSrtp);
}
}
}
void CoreManager::handleChatRoomCreated(const QSharedPointer<ChatRoomModel> &chatRoomModel){
emit chatRoomModelCreated(chatRoomModel);

View file

@ -166,6 +166,7 @@ public:
Q_INVOKABLE bool isLastRemoteProvisioningGood();
Q_INVOKABLE QString getUserAgent()const;
void updateUserAgent();
void addingAccount(const std::shared_ptr<const linphone::AccountParams> params);
public slots:
void initCoreManager();

View file

@ -127,6 +127,8 @@ bool AccountSettingsModel::addOrUpdateAccount (std::shared_ptr<linphone::Account
.arg(QString::fromStdString(account->getParams()->getIdentityAddress()->asString()));
return false;
}
coreManager->addingAccount(account->getParams());
coreManager->getSettingsModel()->configureRlsUri(account);
}else
coreManager->getSettingsModel()->configureRlsUri();

View file

@ -37,12 +37,11 @@ TabContainer {
return encryptions
})()
Component.onCompleted: {
var toFound = SettingsModel.mediaEncryption
property var currentEncryption: SettingsModel.mediaEncryption
onCurrentEncryptionChanged: {
currentIndex = Number(
Utils.findIndex(encryption.model, function (value) {
return toFound === value.value
return currentEncryption === value.value
})
)
}