Commit 69d9e1de authored by Matthieu Tanon's avatar Matthieu Tanon
Browse files

Improve limeV2Enabled and enableLimeV2

parent 460994cb
...@@ -144,10 +144,7 @@ Core::Core () : Object(*new CorePrivate) { ...@@ -144,10 +144,7 @@ Core::Core () : Object(*new CorePrivate) {
Core::~Core () { Core::~Core () {
lInfo() << "Destroying core: " << this; lInfo() << "Destroying core: " << this;
//delete getEncryptionEngine(); enableLimeV2(FALSE);
if (getEncryptionEngine() == nullptr) {
delete getEncryptionEngine();
}
xercesc::XMLPlatformUtils::Terminate(); xercesc::XMLPlatformUtils::Terminate();
} }
...@@ -206,13 +203,18 @@ EncryptionEngineListener *Core::getEncryptionEngine () const { ...@@ -206,13 +203,18 @@ EncryptionEngineListener *Core::getEncryptionEngine () const {
void Core::enableLimeV2 (bool enable) { void Core::enableLimeV2 (bool enable) {
L_D(); L_D();
if (d->imee != nullptr) { if (!enable) {
d->imee.release(); if (d->imee != nullptr)
d->imee.release();
return;
} }
if (!enable) if (limeV2Enabled())
return; return;
if (d->imee != nullptr)
d->imee.release();
LimeV2 *limeV2Engine; LimeV2 *limeV2Engine;
if (d->imee == nullptr) { if (d->imee == nullptr) {
string db_access = "test.c25519.sqlite3"; string db_access = "test.c25519.sqlite3";
...@@ -235,7 +237,6 @@ void Core::enableLimeV2 (bool enable) { ...@@ -235,7 +237,6 @@ void Core::enableLimeV2 (bool enable) {
return; return;
IdentityAddress ia = IdentityAddress(linphone_address_as_string_uri_only(la)); IdentityAddress ia = IdentityAddress(linphone_address_as_string_uri_only(la));
string localDeviceId = ia.asString(); string localDeviceId = ia.asString();
if (localDeviceId == "") if (localDeviceId == "")
...@@ -268,7 +269,8 @@ void Core::updateLimeV2 (void) const { ...@@ -268,7 +269,8 @@ void Core::updateLimeV2 (void) const {
bool Core::limeV2Enabled (void) const { bool Core::limeV2Enabled (void) const {
L_D(); L_D();
// check lime_v2 parameter in proxy config // check lime_v2 parameter in proxy config
if (d->imee != nullptr) // check result of dynamic cast
// check EngineType parameter
if (d->imee != nullptr && d->imee->getEngineType() == EncryptionEngineListener::EngineType::LimeV2) if (d->imee != nullptr && d->imee->getEngineType() == EncryptionEngineListener::EngineType::LimeV2)
return true; return true;
return false; return false;
...@@ -276,11 +278,11 @@ bool Core::limeV2Enabled (void) const { ...@@ -276,11 +278,11 @@ bool Core::limeV2Enabled (void) const {
// TODO does not work // TODO does not work
bool Core::limeV2Available(void) const { bool Core::limeV2Available(void) const {
#ifdef HAVE_LIME #ifdef HAVE_LIME
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
LINPHONE_END_NAMESPACE LINPHONE_END_NAMESPACE
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