From 0bb4b5423e11f3badd4676f3938fc63cafdc42b3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Mar 2026 10:36:04 +0100 Subject: [PATCH] Revert "change ephemeral api from SDK update" This reverts commit 49bc5de54eef27124adb9a8c7d3ccee150f0302f. --- Linphone/core/chat/ChatCore.cpp | 3 +++ Linphone/core/chat/ChatCore.hpp | 3 ++- Linphone/model/chat/ChatModel.cpp | 13 +++++++------ Linphone/model/chat/ChatModel.hpp | 1 + Linphone/model/conference/ConferenceInfoModel.cpp | 2 +- Linphone/model/tool/ToolModel.cpp | 4 ++-- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 5970a95c3..c09c5dd3d 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -334,6 +334,9 @@ 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 0491400bf..2796fc24a 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 NOTIFY ephemeralEnabledChanged) + Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled WRITE lEnableEphemeral NOTIFY ephemeralEnabledChanged) Q_PROPERTY( int ephemeralLifetime READ getEphemeralLifetime WRITE lSetEphemeralLifetime NOTIFY ephemeralLifetimeChanged) Q_PROPERTY(bool muted READ isMuted WRITE lSetMuted NOTIFY mutedChanged) @@ -190,6 +190,7 @@ 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 ccda264cb..403dcbe24 100644 --- a/Linphone/model/chat/ChatModel.cpp +++ b/Linphone/model/chat/ChatModel.cpp @@ -147,14 +147,15 @@ void ChatModel::setMuted(bool muted) { emit mutedChanged(muted); } +void ChatModel::enableEphemeral(bool enable) { + mMonitor->enableEphemeral(enable); + emit ephemeralEnableChanged(enable); +} + void ChatModel::setEphemeralLifetime(int time) { - if (time != 0) { - mMonitor->activateEphemeral(time, mMonitor->getEphemeralNotReadLifetime()); - } else { - mMonitor->deactivateEphemeral(); - } + mMonitor->setEphemeralLifetime(time); emit ephemeralLifetimeChanged(time); - emit ephemeralEnableChanged(time != 0); + enableEphemeral(time != 0); } void ChatModel::deleteHistory() { diff --git a/Linphone/model/chat/ChatModel.hpp b/Linphone/model/chat/ChatModel.hpp index 181505ec6..19cdb018a 100644 --- a/Linphone/model/chat/ChatModel.hpp +++ b/Linphone/model/chat/ChatModel.hpp @@ -80,6 +80,7 @@ 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 2d6fb6748..dc5efd16c 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->deactivateEphemeral(); + chatParams->setEphemeralLifetime(0); 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 12f3400c2..aeda8f1a1 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->deactivateEphemeral(); + chatParams->setEphemeralLifetime(0); 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::listdeactivateEphemeral(); + chatParams->setEphemeralLifetime(0); chatParams->setBackend(linphone::ChatRoom::Backend::FlexisipChat); auto accountParams = account->getParams();