diff --git a/src/calladapter.cpp b/src/calladapter.cpp index 346b8cc500ec7ba4642437269536197e9cf7dcdd..6f973bd3e50644c16a4a474d4cad95c1ba32ddb5 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -421,26 +421,34 @@ CallAdapter::connectCallModel(const QString& accountId) if (!convInfo.confId.isEmpty()) { auto callList = LRCInstance::getAPI().getConferenceSubcalls(convInfo.confId); if (callList.empty()) { - auto lastConferencee = LRCInstance::instance().popLastConferencee( + auto lastConference = LRCInstance::instance().poplastConference( convInfo.confId); - callList.append(lastConferencee); + if (!lastConference.isEmpty()) { + callList.append(lastConference); + forceCallOnly = true; + } + } + if (callList.isEmpty()) { + callList = LRCInstance::getActiveCalls(); forceCallOnly = true; } for (const auto& callId : callList) { if (!callModel->hasCall(callId)) { continue; } - auto otherConv = LRCInstance::getConversationFromCallId(callId); - if (!otherConv.uid.isEmpty() && otherConv.uid != convInfo.uid) { - /* - * Reset the call view corresponding accountId, uid. - */ - LRCInstance::setSelectedConvId(otherConv.uid); - updateCall(otherConv.uid, otherConv.accountId, forceCallOnly); + auto currentCall = callModel->getCall(callId); + if (currentCall.status == lrc::api::call::Status::IN_PROGRESS) { + auto otherConv = LRCInstance::getConversationFromCallId(callId); + if (!otherConv.uid.isEmpty() && otherConv.uid != convInfo.uid) { + /* + * Reset the call view corresponding accountId, uid. + */ + LRCInstance::setSelectedConvId(otherConv.uid); + updateCall(otherConv.uid, otherConv.accountId, forceCallOnly); + } } } } - break; } case lrc::api::call::Status::CONNECTED: @@ -527,7 +535,7 @@ CallAdapter::hangupCall(const QString& uri) if (callList.size() == 2) { for (const auto& cId : callList) { if (cId != convInfo.callId) { - LRCInstance::instance().pushLastConferencee(convInfo.confId, cId); + LRCInstance::instance().pushlastConference(convInfo.confId, cId); } } } @@ -553,7 +561,8 @@ CallAdapter::maximizeParticipant(const QString& uri) if (participant["uri"] == uri) { if (participant["active"] == "false") { callModel->setActiveParticipant(confId, uri); - callModel->setConferenceLayout(confId, lrc::api::call::Layout::ONE_WITH_SMALL); + callModel->setConferenceLayout(confId, + lrc::api::call::Layout::ONE_WITH_SMALL); } else if (participant["y"].toInt() != 0) { callModel->setActiveParticipant(confId, uri); callModel->setConferenceLayout(confId, lrc::api::call::Layout::ONE); @@ -585,7 +594,8 @@ CallAdapter::minimizeParticipant(const QString& uri) if (participant["uri"] == uri) { if (participant["active"] == "true") { if (participant["y"].toInt() == 0) { - callModel->setConferenceLayout(confId, lrc::api::call::Layout::ONE_WITH_SMALL); + callModel->setConferenceLayout(confId, + lrc::api::call::Layout::ONE_WITH_SMALL); } else { callModel->setConferenceLayout(confId, lrc::api::call::Layout::GRID); } @@ -679,7 +689,8 @@ CallAdapter::isModerator(const QString& uri) const confId = conversation.callId; try { return callModel->isModerator(confId, uri); - } catch (...) {} + } catch (...) { + } return false; } @@ -719,7 +730,8 @@ CallAdapter::setModerator(const QString& uri, const bool state) confId = conversation.callId; try { callModel->setModerator(confId, uri, state); - } catch (...) {} + } catch (...) { + } } void @@ -734,7 +746,8 @@ CallAdapter::muteParticipant(const QString& uri, const bool state) try { const auto call = callModel->getCall(confId); callModel->muteParticipant(confId, uri, state); - } catch (...) {} + } catch (...) { + } } bool @@ -772,7 +785,8 @@ CallAdapter::hangupParticipant(const QString& uri) try { const auto call = callModel->getCall(confId); callModel->hangupParticipant(confId, uri); - } catch (...) {} + } catch (...) { + } } void diff --git a/src/lrcinstance.h b/src/lrcinstance.h index 909806e83fbec5448d5422c755bdda6dabb14fcf..69bcef2668460316caf672f2787df1e2b9bc694e 100644 --- a/src/lrcinstance.h +++ b/src/lrcinstance.h @@ -426,18 +426,18 @@ public: instance().contentDrafts_[draftKey] = content; } - static void pushLastConferencee(const QString& confId, const QString& callId) + static void pushlastConference(const QString& confId, const QString& callId) { - instance().lastConferencees_[confId] = callId; + instance().lastConferences_[confId] = callId; } - static QString popLastConferencee(const QString& confId) + static QString poplastConference(const QString& confId) { QString callId = {}; - auto iter = instance().lastConferencees_.find(confId); - if (iter != instance().lastConferencees_.end()) { + auto iter = instance().lastConferences_.find(confId); + if (iter != instance().lastConferences_.end()) { callId = iter.value(); - instance().lastConferencees_.erase(iter); + instance().lastConferences_.erase(iter); } return callId; } @@ -468,6 +468,6 @@ private: QString selectedAccountId_; QString selectedConvUid_; MapStringString contentDrafts_; - MapStringString lastConferencees_; + MapStringString lastConferences_; }; Q_DECLARE_METATYPE(LRCInstance*)