From 35ed305af1b4ac28f74f5cbb335b751bc73287ab Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 5 Feb 2026 16:59:02 +0100 Subject: [PATCH] Set presence to busy when reset presence when in call (Mantis 0014443) --- Linphone/core/account/AccountCore.cpp | 12 +++++++++++- Linphone/core/account/AccountCore.hpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Linphone/core/account/AccountCore.cpp b/Linphone/core/account/AccountCore.cpp index 768e756e9..86af0ba70 100644 --- a/Linphone/core/account/AccountCore.cpp +++ b/Linphone/core/account/AccountCore.cpp @@ -298,6 +298,16 @@ void AccountCore::setSelf(QSharedPointer me) { mAccountModel->setPresence(presence, userInitiated, resetToAuto, presenceNote); }); }); + mAccountModelConnection->makeConnectToCore( + &AccountCore::lResetToAutomaticPresence, [this](bool userInitiated, bool resetToAuto) { + mAccountModelConnection->invokeToModel([this, userInitiated, resetToAuto, presenceNote = mPresenceNote]() { + auto core = CoreModel::getInstance()->getCore(); + if (!core) return; + mAccountModel->setPresence(core->getCallsNb() == 0 ? LinphoneEnums::Presence::Online + : LinphoneEnums::Presence::Busy, + userInitiated, resetToAuto, presenceNote); + }); + }); DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, voicemailCount, VoicemailCount) @@ -904,7 +914,7 @@ QString AccountCore::getPresenceStatus() { } void AccountCore::resetToAutomaticPresence() { - emit lSetPresence(LinphoneEnums::Presence::Online, false, true); + emit lResetToAutomaticPresence(false, true); } LinphoneEnums::Presence AccountCore::getExplicitPresence() { diff --git a/Linphone/core/account/AccountCore.hpp b/Linphone/core/account/AccountCore.hpp index 6a90cc32f..9e326fba1 100644 --- a/Linphone/core/account/AccountCore.hpp +++ b/Linphone/core/account/AccountCore.hpp @@ -240,6 +240,7 @@ signals: void lSetRegisterEnabled(bool enabled); void lSetNotificationsAllowed(bool value); void lSetPresence(LinphoneEnums::Presence presence, bool userInitiated = true, bool resetToAuto = false); + void lResetToAutomaticPresence(bool userInitiated = true, bool resetToAuto = false); protected: void writeIntoModel(std::shared_ptr model) const;