conference: fix host client leaving conference on peer disconnect

* Implements similar logic to that of patch 32322 in slotOnConferenceInfosUpdated to fall back to suitable conversation when necessary

GitLab: #2130
Change-Id: Id8ce91403602198499f5e8bda65ce4e3560b014b
This commit is contained in:
ebjarstal
2025-11-26 13:15:42 -05:00
committed by Eric Bjarstal
parent ed4960eb6a
commit beb7a52766

View File

@@ -1639,6 +1639,7 @@ CallModelPimpl::slotOnConferenceInfosUpdated(const QString& confId, const Vector
// For now, the rendez-vous account can see ongoing calls
// And must be notified when a new
QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId);
qDebug() << "[conf:" << confId << "] Conference infos updated. Calls remaining:" << callList.size();
Q_FOREACH (const auto& call, callList) {
Q_EMIT linked.callAddedToConference(call, "", confId);
if (calls.find(call) == calls.end()) {
@@ -1658,6 +1659,21 @@ CallModelPimpl::slotOnConferenceInfosUpdated(const QString& confId, const Vector
participantIt->second->update(infos);
it->second->layout = participantIt->second->getLayout();
// Check if we need to switch conversation
auto currentConversation = linked.owner.conversationModel->getConversationForCallId(confId);
if (currentConversation && callList.size() >= 2 && participantIt != participantsModel.end()) {
qDebug() << "[conf:" << confId << "] Checking if client should switch to another conversation";
auto fallbackConversation = getFallbackConversationForConference(confId);
// If fallback conversation is not nullopt, switch to it
if (fallbackConversation) {
currentConversation->get().confId.clear();
fallbackConversation->get().confId = confId;
fallbackConversation->get().callId = confId;
linked.owner.conversationModel->selectConversation(fallbackConversation->get().uid);
qWarning() << "[conf:" << confId << "] Selected fallback conversation:" << fallbackConversation->get().uid;
}
}
// if Jami, remove @ring.dht
for (auto& i : participantIt->second->getParticipants()) {
i.uri.replace("@ring.dht", "");