Commit 0fb44e60 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(CoreManager): add TODO to remove hardcoded values and use constexpr instead of define

parent 1131bc53
...@@ -38,14 +38,22 @@ ...@@ -38,14 +38,22 @@
#include "CoreManager.hpp" #include "CoreManager.hpp"
#define CBS_CALL_INTERVAL 20
#define DOWNLOAD_URL "https://www.linphone.org/technical-corner/linphone/downloads"
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
namespace {
constexpr int cCbsCallInterval = 20;
// TODO: Remove hardcoded values. Use config directly.
constexpr char cLinphoneDomain[] = "sip.linphone.org";
constexpr char cDefaultContactParameters[] = "message-expires=604800";
constexpr int cDefaultExpires = 3600;
constexpr char cDownloadUrl[] = "https://www.linphone.org/technical-corner/linphone/downloads";
}
// -----------------------------------------------------------------------------
CoreManager *CoreManager::mInstance = nullptr; CoreManager *CoreManager::mInstance = nullptr;
CoreManager::CoreManager (QObject *parent, const QString &configPath) : CoreManager::CoreManager (QObject *parent, const QString &configPath) :
...@@ -125,7 +133,7 @@ void CoreManager::init (QObject *parent, const QString &configPath) { ...@@ -125,7 +133,7 @@ void CoreManager::init (QObject *parent, const QString &configPath) {
mInstance = new CoreManager(parent, configPath); mInstance = new CoreManager(parent, configPath);
QTimer *timer = mInstance->mCbsTimer = new QTimer(mInstance); QTimer *timer = mInstance->mCbsTimer = new QTimer(mInstance);
timer->setInterval(CBS_CALL_INTERVAL); timer->setInterval(cCbsCallInterval);
QObject::connect(timer, &QTimer::timeout, mInstance, &CoreManager::iterate); QObject::connect(timer, &QTimer::timeout, mInstance, &CoreManager::iterate);
} }
...@@ -254,9 +262,9 @@ void CoreManager::migrate () { ...@@ -254,9 +262,9 @@ void CoreManager::migrate () {
// Add message_expires param on old proxy configs. // Add message_expires param on old proxy configs.
for (const auto &proxyConfig : mCore->getProxyConfigList()) { for (const auto &proxyConfig : mCore->getProxyConfigList()) {
if (proxyConfig->getDomain() == "sip.linphone.org") { if (proxyConfig->getDomain() == cLinphoneDomain) {
proxyConfig->setContactParameters("message-expires=604800"); proxyConfig->setContactParameters(cDefaultContactParameters);
proxyConfig->setExpires(3600); proxyConfig->setExpires(cDefaultExpires);
proxyConfig->done(); proxyConfig->done();
} }
} }
...@@ -294,5 +302,5 @@ void CoreManager::handleLogsUploadStateChanged (linphone::CoreLogCollectionUploa ...@@ -294,5 +302,5 @@ void CoreManager::handleLogsUploadStateChanged (linphone::CoreLogCollectionUploa
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
QString CoreManager::getDownloadUrl () { QString CoreManager::getDownloadUrl () {
return QStringLiteral(DOWNLOAD_URL); return cDownloadUrl;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment