diff --git a/daemon b/daemon index d15b4f79613a3cbbd427ea331958f48e4a34f0a4..e2107772fd3d0b11f0721dec98f95a610b7f9a77 160000 --- a/daemon +++ b/daemon @@ -1 +1 @@ -Subproject commit d15b4f79613a3cbbd427ea331958f48e4a34f0a4 +Subproject commit e2107772fd3d0b11f0721dec98f95a610b7f9a77 diff --git a/src/app/calladapter.cpp b/src/app/calladapter.cpp index 169ba6cf711974c0e8f2e1d8e61950de90aae8f3..0cc2aaa6a83e6c10d4df834bdf7e0d005b872128 100644 --- a/src/app/calladapter.cpp +++ b/src/app/calladapter.cpp @@ -354,10 +354,11 @@ CallAdapter::onCallInfosChanged(const QString& accountId, const QString& callId) } void -CallAdapter::onCallAddedToConference(const QString& callId, const QString& confId) +CallAdapter::onCallAddedToConference(const QString& callId, const QString& conversationId, const QString& confId) { Q_UNUSED(callId) Q_UNUSED(confId) + Q_UNUSED(conversationId) saveConferenceSubcalls(); } diff --git a/src/app/calladapter.h b/src/app/calladapter.h index a3ebf6153b599a225720cd5862c888b1a0520628..a1b98de4650e4f20eb24ab1b7dde0068ef0bf888 100644 --- a/src/app/calladapter.h +++ b/src/app/calladapter.h @@ -122,7 +122,7 @@ public Q_SLOTS: void onAccountChanged(); void onCallStatusChanged(const QString& accountId, const QString& callId); void onCallStatusChanged(const QString& callId, int code); - void onCallAddedToConference(const QString& callId, const QString& confId); + void onCallAddedToConference(const QString& callId, const QString& conversationId, const QString& confId); void onCallStarted(const QString& callId); void onCallEnded(const QString& callId); void onCallInfosChanged(const QString& accountId, const QString& callId); diff --git a/src/libclient/api/callmodel.h b/src/libclient/api/callmodel.h index e9a077895d9acd506b0f61602a4648c766519115..e2d0fdc24cab99ae8e53a510131327da15dedc3d 100644 --- a/src/libclient/api/callmodel.h +++ b/src/libclient/api/callmodel.h @@ -480,9 +480,10 @@ Q_SIGNALS: /** * Emitted when a call is added to a conference * @param callId + * @param conversationId * @param confId */ - void callAddedToConference(const QString& callId, const QString& confId) const; + void callAddedToConference(const QString& callId, const QString& conversationId, const QString& confId) const; /** * Emitted when a voice mail notice arrives diff --git a/src/libclient/callbackshandler.cpp b/src/libclient/callbackshandler.cpp index 06c7df295e29e34be7f80c94d4714718aa7b5647..51acb43c803b606ebfcad9f0b17c71220bd4d261 100644 --- a/src/libclient/callbackshandler.cpp +++ b/src/libclient/callbackshandler.cpp @@ -548,9 +548,9 @@ CallbacksHandler::slotIncomingMessage(const QString& accountId, } void -CallbacksHandler::slotConferenceCreated(const QString& accountId, const QString& callId) +CallbacksHandler::slotConferenceCreated(const QString& accountId, const QString& convId, const QString& callId) { - Q_EMIT conferenceCreated(accountId, callId); + Q_EMIT conferenceCreated(accountId, convId, callId); } void diff --git a/src/libclient/callbackshandler.h b/src/libclient/callbackshandler.h index 78c73a639998c0b32b8292f303672c30886c875c..d96c1393662bbb057359ac30b1f627959257c431 100644 --- a/src/libclient/callbackshandler.h +++ b/src/libclient/callbackshandler.h @@ -173,7 +173,7 @@ Q_SIGNALS: * Connect this signal to know when a new conference is created * @param callId of the conference */ - void conferenceCreated(const QString& accountId, const QString& callId); + void conferenceCreated(const QString& accountId, const QString& conversationId, const QString& callId); void conferenceChanged(const QString& accountId, const QString& confId, const QString& state); /** * Connect this signal to know when a conference is removed @@ -500,9 +500,10 @@ private Q_SLOTS: /** * Emit conferenceCreated * @param accountId - * @param callId of the conference + * @param callId of the conference + * @param conversationId of the conference */ - void slotConferenceCreated(const QString& accountId, const QString& callId); + void slotConferenceCreated(const QString& accountId, const QString& conversationId, const QString& callId); /** * Emit conferenceRemove * @param accountId diff --git a/src/libclient/callmodel.cpp b/src/libclient/callmodel.cpp index 1befc4b690f009742e88e205aa81e84ccba10859..83513d5000739af8d5a692a04fcf93f7db851a12 100644 --- a/src/libclient/callmodel.cpp +++ b/src/libclient/callmodel.cpp @@ -236,7 +236,7 @@ public Q_SLOTS: * Listen from CallbacksHandler when a conference is created. * @param callId */ - void slotConferenceCreated(const QString& accountId, const QString& callId); + void slotConferenceCreated(const QString& accountId, const QString& conversationId, const QString& callId); void slotConferenceChanged(const QString& accountId, const QString& callId, const QString& state); @@ -839,12 +839,12 @@ CallModel::joinCalls(const QString& callIdA, const QString& callIdB) const try { auto& accountInfo = owner.accountModel->getAccountInfo(accountIdCall1); if (accountInfo.callModel->hasCall(callIdA)) { - Q_EMIT accountInfo.callModel->callAddedToConference(callIdA, callIdB); + Q_EMIT accountInfo.callModel->callAddedToConference(callIdA, "", callIdB); } } catch (...) { } } else { - Q_EMIT callAddedToConference(callIdA, callIdB); + Q_EMIT callAddedToConference(callIdA, "", callIdB); } } else if (call1.type == call::Type::CONFERENCE || call2.type == call::Type::CONFERENCE) { auto call = call1.type == call::Type::CONFERENCE ? callIdB : callIdA; @@ -863,12 +863,12 @@ CallModel::joinCalls(const QString& callIdA, const QString& callIdB) const try { auto& accountInfo = owner.accountModel->getAccountInfo(accountCall); if (accountInfo.callModel->hasCall(call)) { - accountInfo.callModel->pimpl_->slotConferenceCreated(owner.id, conf); + accountInfo.callModel->pimpl_->slotConferenceCreated(owner.id, "", conf); } } catch (...) { } } else - Q_EMIT callAddedToConference(call, conf); + Q_EMIT callAddedToConference(call, "", conf); // Remove from pendingConferences_ for (int i = 0; i < pimpl_->pendingConferencees_.size(); ++i) { @@ -1169,7 +1169,7 @@ CallModelPimpl::initConferencesFromDaemon() ? call::Status::IN_PROGRESS : call::Status::PAUSED; callInfo->startTime = now - std::chrono::seconds(diff); - Q_EMIT linked.callAddedToConference(call, callId); + Q_EMIT linked.callAddedToConference(call, "", callId); } callInfo->type = call::Type::CONFERENCE; VectorMapStringString infos = CallManager::instance().getConferenceInfos(linked.owner.id, @@ -1660,7 +1660,7 @@ CallModelPimpl::slotOnConferenceInfosUpdated(const QString& confId, // And must be notified when a new QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); Q_FOREACH (const auto& call, callList) { - Q_EMIT linked.callAddedToConference(call, confId); + Q_EMIT linked.callAddedToConference(call, "", confId); if (calls.find(call) == calls.end()) { qWarning() << "Call not found"; } else { @@ -1710,11 +1710,10 @@ CallModel::hasCall(const QString& callId) const } void -CallModelPimpl::slotConferenceCreated(const QString& accountId, const QString& confId) +CallModelPimpl::slotConferenceCreated(const QString& accountId, const QString& conversationId, const QString& confId) { if (accountId != linked.owner.id) return; - QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); auto callInfo = std::make_shared<call::Info>(); callInfo->id = confId; @@ -1734,22 +1733,27 @@ CallModelPimpl::slotConferenceCreated(const QString& accountId, const QString& c calls[confId] = callInfo; QString currentCallId = currentCall_; - Q_FOREACH (const auto& call, callList) { - Q_EMIT linked.callAddedToConference(call, confId); - // Remove call from pendingConferences_ - for (int i = 0; i < pendingConferencees_.size(); ++i) { - if (pendingConferencees_.at(i).callId == call) { - Q_EMIT linked.beginRemovePendingConferenceesRows(i); - pendingConferencees_.removeAt(i); - Q_EMIT linked.endRemovePendingConferenceesRows(); - break; + if (!conversationId.isEmpty()) { + Q_EMIT linked.callAddedToConference("", conversationId, confId); + } else { + QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); + Q_FOREACH (const auto& call, callList) { + Q_EMIT linked.callAddedToConference(call, "", confId); + // Remove call from pendingConferences_ + for (int i = 0; i < pendingConferencees_.size(); ++i) { + if (pendingConferencees_.at(i).callId == call) { + Q_EMIT linked.beginRemovePendingConferenceesRows(i); + pendingConferencees_.removeAt(i); + Q_EMIT linked.endRemovePendingConferenceesRows(); + break; + } } + if (call == currentCall_) + currentCall_ = confId; } - if (call == currentCall_) - currentCall_ = confId; + if (currentCallId != currentCall_) + Q_EMIT linked.currentCallChanged(confId); } - if (currentCallId != currentCall_) - Q_EMIT linked.currentCallChanged(confId); } void @@ -1763,7 +1767,7 @@ CallModelPimpl::slotConferenceChanged(const QString& accountId, QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); QString currentCallId = currentCall_; Q_FOREACH (const auto& call, callList) { - Q_EMIT linked.callAddedToConference(call, confId); + Q_EMIT linked.callAddedToConference(call, "", confId); if (call == currentCall_) currentCall_ = confId; } diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index 63d644daeddc677372019e801d17460afb4ca3a9..093f1d7d095a809ec73d1530daa2d0325415d3e5 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -310,9 +310,10 @@ public Q_SLOTS: /** * Listen from CallModel when a call is added to a conference * @param callId + * @param conversationId * @param confId */ - void slotCallAddedToConference(const QString& callId, const QString& confId); + void slotCallAddedToConference(const QString& callId, const QString& conversationId, const QString& confId); /** * Listen from CallbacksHandler when a conference is deleted. * @param accountId @@ -3457,10 +3458,11 @@ ConversationModelPimpl::addIncomingMessage(const QString& peerId, } void -ConversationModelPimpl::slotCallAddedToConference(const QString& callId, const QString& confId) +ConversationModelPimpl::slotCallAddedToConference(const QString& callId, const QString& conversationId, const QString& confId) { for (auto& conversation : conversations) { - if (conversation.callId == callId && conversation.confId != confId) { + if ((conversationId == conversation.uid) + || (!callId.isEmpty() && conversation.callId == callId && conversation.confId != confId)) { conversation.confId = confId; invalidateModel(); // Refresh the conference status only if attached diff --git a/src/libclient/qtwrapper/callmanager_wrap.h b/src/libclient/qtwrapper/callmanager_wrap.h index 735d2446c83e6acf9afbb97c9feb0bf610b038a4..1a7ac966c8369b0a7da5a81e484d967a5488522b 100644 --- a/src/libclient/qtwrapper/callmanager_wrap.h +++ b/src/libclient/qtwrapper/callmanager_wrap.h @@ -144,11 +144,12 @@ public: QString(filepath.c_str())); }), exportable_callback<CallSignal::ConferenceCreated>( - [this](const std::string& accountId, const std::string& confId) { - LOG_LIBJAMI_SIGNAL2("conferenceCreated", + [this](const std::string& accountId, const std::string& conversationId, const std::string& confId) { + LOG_LIBJAMI_SIGNAL3("conferenceCreated", QString(accountId.c_str()), + QString(conversationId.c_str()), QString(confId.c_str())); - Q_EMIT conferenceCreated(QString(accountId.c_str()), QString(confId.c_str())); + Q_EMIT conferenceCreated(QString(accountId.c_str()), QString(conversationId.c_str()), QString(confId.c_str())); }), exportable_callback<CallSignal::ConferenceChanged>([this](const std::string& accountId, const std::string& confId, @@ -628,7 +629,7 @@ Q_SIGNALS: // SIGNALS const QString& callId, const VectorMapStringString& mediaList); void recordPlaybackFilepath(const QString& callId, const QString& filepath); - void conferenceCreated(const QString& accountId, const QString& confId); + void conferenceCreated(const QString& accountId, const QString& conversationId, const QString& confId); void conferenceChanged(const QString& accountId, const QString& confId, const QString& state); void updatePlaybackScale(const QString& filepath, int position, int size); void conferenceRemoved(const QString& accountId, const QString& confId);