diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index c09c5dd3d..5970a95c3 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -334,9 +334,6 @@ void ChatCore::setSelf(const QSharedPointer &me) { }); }); - mChatModelConnection->makeConnectToCore(&ChatCore::lEnableEphemeral, [this](bool enable) { - mChatModelConnection->invokeToModel([this, enable]() { mChatModel->enableEphemeral(enable); }); - }); mChatModelConnection->makeConnectToModel(&ChatModel::ephemeralEnableChanged, [this](bool enable) { mChatModelConnection->invokeToCore([this, enable]() { if (mEphemeralEnabled != enable) { diff --git a/Linphone/core/chat/ChatCore.hpp b/Linphone/core/chat/ChatCore.hpp index 2796fc24a..0491400bf 100644 --- a/Linphone/core/chat/ChatCore.hpp +++ b/Linphone/core/chat/ChatCore.hpp @@ -60,7 +60,7 @@ public: Q_PROPERTY(bool isSecured READ isSecured WRITE setIsSecured NOTIFY isSecuredChanged) Q_PROPERTY(bool isBasic MEMBER mIsBasic CONSTANT) Q_PROPERTY(QString sendingText READ getSendingText WRITE setSendingText NOTIFY sendingTextChanged) - Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled WRITE lEnableEphemeral NOTIFY ephemeralEnabledChanged) + Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled NOTIFY ephemeralEnabledChanged) Q_PROPERTY( int ephemeralLifetime READ getEphemeralLifetime WRITE lSetEphemeralLifetime NOTIFY ephemeralLifetimeChanged) Q_PROPERTY(bool muted READ isMuted WRITE lSetMuted NOTIFY mutedChanged) @@ -190,7 +190,6 @@ signals: void lCompose(); void lLeave(); void lSetMuted(bool muted); - void lEnableEphemeral(bool enable); void lSetEphemeralLifetime(int time); void lSetSubject(QString subject); void lRemoveParticipant(QString sipAddress); diff --git a/Linphone/model/chat/ChatModel.cpp b/Linphone/model/chat/ChatModel.cpp index 403dcbe24..ccda264cb 100644 --- a/Linphone/model/chat/ChatModel.cpp +++ b/Linphone/model/chat/ChatModel.cpp @@ -147,15 +147,14 @@ void ChatModel::setMuted(bool muted) { emit mutedChanged(muted); } -void ChatModel::enableEphemeral(bool enable) { - mMonitor->enableEphemeral(enable); - emit ephemeralEnableChanged(enable); -} - void ChatModel::setEphemeralLifetime(int time) { - mMonitor->setEphemeralLifetime(time); + if (time != 0) { + mMonitor->activateEphemeral(time, mMonitor->getEphemeralNotReadLifetime()); + } else { + mMonitor->deactivateEphemeral(); + } emit ephemeralLifetimeChanged(time); - enableEphemeral(time != 0); + emit ephemeralEnableChanged(time != 0); } void ChatModel::deleteHistory() { diff --git a/Linphone/model/chat/ChatModel.hpp b/Linphone/model/chat/ChatModel.hpp index 19cdb018a..181505ec6 100644 --- a/Linphone/model/chat/ChatModel.hpp +++ b/Linphone/model/chat/ChatModel.hpp @@ -80,7 +80,6 @@ public: void compose(); linphone::ChatRoom::State getState() const; void setMuted(bool muted); - void enableEphemeral(bool enable); void setEphemeralLifetime(int time); void setSubject(QString subject) const; void removeParticipant(const QString &sipAddress) const; diff --git a/Linphone/model/conference/ConferenceInfoModel.cpp b/Linphone/model/conference/ConferenceInfoModel.cpp index dc5efd16c..2d6fb6748 100644 --- a/Linphone/model/conference/ConferenceInfoModel.cpp +++ b/Linphone/model/conference/ConferenceInfoModel.cpp @@ -73,7 +73,7 @@ void ConferenceInfoModel::setConferenceScheduler(const std::shared_ptrgetChatParams(); if (!chatParams) return; - chatParams->setEphemeralLifetime(0); + chatParams->deactivateEphemeral(); chatParams->setBackend(linphone::ChatRoom::Backend::FlexisipChat); params->setSecurityLevel(linphone::Conference::SecurityLevel::EndToEnd); mConferenceSchedulerModel->getMonitor()->sendInvitations(params); diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index 1c15db99c..bca30ad3f 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -667,7 +667,7 @@ ToolModel::getChatRoomParams(std::shared_ptr call, std::shared_p qWarning() << "failed to get chat params from conference params, return"; return nullptr; } - chatParams->setEphemeralLifetime(0); + chatParams->deactivateEphemeral(); auto accountParams = account->getParams(); auto sameDomain = remoteAddress && remoteAddress->getDomain() == SettingsModel::getInstance()->getDefaultDomain() && remoteAddress->getDomain() == accountParams->getDomain(); @@ -787,7 +787,7 @@ ToolModel::createGroupChatRoom(QString subject, std::listsetEphemeralLifetime(0); + chatParams->deactivateEphemeral(); chatParams->setBackend(linphone::ChatRoom::Backend::FlexisipChat); auto accountParams = account->getParams();