From c353360ee2e3cd89981f181844d6f1fd26f86ad1 Mon Sep 17 00:00:00 2001 From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com> Date: Thu, 10 Dec 2020 13:23:13 -0500 Subject: [PATCH] conference: add kick participant for moderator Change-Id: Ife3de2e6174a9914fe4f164b8ac5a0bf653f0656 --- src/calladapter.cpp | 36 +++++++------------ src/calladapter.h | 2 +- .../components/ParticipantOverlayMenu.qml | 2 +- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/calladapter.cpp b/src/calladapter.cpp index d3e5f363e..346b8cc50 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -723,8 +723,8 @@ CallAdapter::setModerator(const QString& uri, const bool state) } void -CallAdapter::muteParticipant(const QString& uri, const bool state) { - +CallAdapter::muteParticipant(const QString& uri, const bool state) +{ auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get(); auto* convModel = LRCInstance::getCurrentConversationModel(); const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid()); @@ -760,29 +760,19 @@ CallAdapter::isMuted(const QString& uri) const return false; } -bool -CallAdapter::isCurrentMuted() const +void +CallAdapter::hangupParticipant(const QString& uri) { + auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get(); auto* convModel = LRCInstance::getCurrentConversationModel(); - const auto convInfo = convModel->getConversationForUID(convUid_); - if (!convInfo.uid.isEmpty()) { - auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get(); - try { - auto call = callModel->getCall(convInfo.callId); - if (call.participantsInfos.size() == 0) { - return false; - } else { - auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_); - for (const auto& participant : call.participantsInfos) { - if (participant["uri"] == accInfo.profileInfo.uri) - return participant["audioMuted"] == "true"; - } - } - return false; - } catch (...) { - } - } - return true; + const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid()); + auto confId = conversation.confId; + if (confId.isEmpty()) + confId = conversation.callId; + try { + const auto call = callModel->getCall(confId); + callModel->hangupParticipant(confId, uri); + } catch (...) {} } void diff --git a/src/calladapter.h b/src/calladapter.h index f33e6679b..4c59cfe74 100644 --- a/src/calladapter.h +++ b/src/calladapter.h @@ -69,7 +69,7 @@ public: Q_INVOKABLE QVariantList getConferencesInfos(); Q_INVOKABLE void muteParticipant(const QString& uri, const bool state); Q_INVOKABLE bool isMuted(const QString& uri) const; - Q_INVOKABLE bool isCurrentMuted() const; + Q_INVOKABLE void hangupParticipant(const QString& uri); signals: void callStatusChanged(int index, const QString& accountId, const QString& convUid); diff --git a/src/mainview/components/ParticipantOverlayMenu.qml b/src/mainview/components/ParticipantOverlayMenu.qml index 3383abb38..21536158e 100644 --- a/src/mainview/components/ParticipantOverlayMenu.qml +++ b/src/mainview/components/ParticipantOverlayMenu.qml @@ -249,7 +249,7 @@ Rectangle { source: "qrc:/images/icons/ic_block_24px.svg" imageColor: hovered? JamiTheme.darkGreyColor : JamiTheme.whiteColor - onClicked: CallAdapter.hangupCall(uri) + onClicked: CallAdapter.hangupParticipant(uri) onHoveredChanged: hangupParticipantToolTip.visible = hovered Text { -- GitLab