mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-03 22:56:49 +00:00
migrate proxy config
This commit is contained in:
parent
9cf08623e3
commit
8bbc230925
2 changed files with 28 additions and 1 deletions
|
|
@ -74,7 +74,7 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
|
|||
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
|
||||
|
||||
mInstance->mStarted = true;
|
||||
|
||||
mInstance->migrate();
|
||||
emit mInstance->coreStarted();
|
||||
});
|
||||
|
||||
|
|
@ -234,6 +234,32 @@ void CoreManager::createLinphoneCore (const QString &configPath) {
|
|||
setOtherPaths();
|
||||
}
|
||||
|
||||
#define RC_VERSION_NAME "rc_version"
|
||||
#define RC_VERSION_CURRENT 1
|
||||
|
||||
void CoreManager::migrate () {
|
||||
shared_ptr<linphone::Config> config = mCore->getConfig();
|
||||
int rcVersion = config->getInt(SettingsModel::UI_SECTION, RC_VERSION_NAME, 0);
|
||||
if (rcVersion == RC_VERSION_CURRENT)
|
||||
return;
|
||||
if (rcVersion > RC_VERSION_CURRENT) {
|
||||
qWarning() << "RC file version (" << rcVersion << ") is more recent than app rc file version (" << RC_VERSION_CURRENT << ")!!!";
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "Migrate from old rc file (" << rcVersion << "to" << RC_VERSION_CURRENT << ").";
|
||||
|
||||
// Add message_expires param on old proxy configs.
|
||||
for (const auto &proxyConfig : mCore->getProxyConfigList()) {
|
||||
if (proxyConfig->getDomain() == "sip.linphone.org") {
|
||||
proxyConfig->setContactParameters("message-expires=604800");
|
||||
proxyConfig->setExpires(3600);
|
||||
proxyConfig->done();
|
||||
}
|
||||
}
|
||||
config->setInt(SettingsModel::UI_SECTION, RC_VERSION_NAME, RC_VERSION_CURRENT);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CoreManager::getVersion () const {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ private:
|
|||
void setResourcesPaths ();
|
||||
|
||||
void createLinphoneCore (const QString &configPath);
|
||||
void migrate();
|
||||
|
||||
QString getVersion () const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue