Skip to content
Snippets Groups Projects
Commit 7712952a authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk
Browse files

newaccountmodel: wait for accountDetailsChanged before settings credentials and fix realm


Change-Id: I84a5a65451816f6f87c5a91851f42cfb5cac4920
Reviewed-by: default avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 0089e4b3
No related branches found
No related tags found
No related merge requests found
...@@ -184,17 +184,6 @@ NewAccountModel::setAccountConfig(const std::string& accountId, ...@@ -184,17 +184,6 @@ NewAccountModel::setAccountConfig(const std::string& accountId,
details[ConfProperties::USERNAME] = toQString(confProperties.username); details[ConfProperties::USERNAME] = toQString(confProperties.username);
} }
configurationManager.setAccountDetails(QString::fromStdString(accountId), details); configurationManager.setAccountDetails(QString::fromStdString(accountId), details);
// Refresh credentials for SIP accounts
if (accountInfo.profileInfo.type == profile::Type::SIP) {
MapStringString credentials;
credentials[ConfProperties::USERNAME] = toQString(confProperties.username);
credentials[ConfProperties::PASSWORD] = toQString(confProperties.password);
credentials[ConfProperties::REALM] = QString("*");
QVector<MapStringString> credentialsVec;
credentialsVec.append(credentials);
ConfigurationManager::instance().setCredentials(accountId.c_str(), credentialsVec);
}
} }
account::ConfProperties_t account::ConfProperties_t
...@@ -363,6 +352,20 @@ NewAccountModelPimpl::slotAccountDetailsChanged(const std::string& accountId, co ...@@ -363,6 +352,20 @@ NewAccountModelPimpl::slotAccountDetailsChanged(const std::string& accountId, co
} }
accountInfo->second.fromDetails(convertMap(details)); accountInfo->second.fromDetails(convertMap(details));
// Refresh credentials for SIP accounts
if (accountInfo->second.profileInfo.type == profile::Type::SIP) {
auto& confProperties = accountInfo->second.confProperties;
MapStringString credentials;
using namespace DRing::Account;
credentials[ConfProperties::USERNAME] = toQString(confProperties.username);
credentials[ConfProperties::PASSWORD] = toQString(confProperties.password);
credentials[ConfProperties::REALM] = confProperties.realm.empty()? QString("*") : toQString(confProperties.realm);
QVector<MapStringString> credentialsVec;
credentialsVec.append(credentials);
ConfigurationManager::instance().setCredentials(accountId.c_str(), credentialsVec);
}
emit linked.accountStatusChanged(accountId); emit linked.accountStatusChanged(accountId);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment