1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

lrc: avoid excessive copying of conversation info objects

1. Container View api
2. use optional conversation info ref api

Change-Id: I38aa57edc1fbf304ea0ef95d48000e0495c409ee
This commit is contained in:
Mingrui Zhang 2020-12-15 11:55:38 -05:00 committed by Ming Rui Zhang
parent 44ebb170ff
commit 9ef94561a5
14 changed files with 204 additions and 283 deletions

View file

@ -379,17 +379,16 @@ AccountAdapter::connectAccount(const QString& accountId)
= QObject::connect(accInfo.contactModel.get(),
&lrc::api::ContactModel::contactAdded,
[this, accountId](const QString& contactUri) {
auto& accInfo = LRCInstance::accountModel().getAccountInfo(
accountId);
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(
const auto& convInfo = LRCInstance::getConversationFromConvUid(
LRCInstance::getCurrentConvUid());
if (conversation.uid.isEmpty()) {
if (convInfo.uid.isEmpty()) {
return;
}
auto& accInfo = LRCInstance::accountModel().getAccountInfo(
accountId);
if (contactUri
== accInfo.contactModel
->getContact(conversation.participants.at(0))
->getContact(convInfo.participants.at(0))
.profileInfo.uri) {
/*
* Update conversation.

View file

@ -234,9 +234,8 @@ AvAdapter::stopAudioMeter(bool async)
const QString&
AvAdapter::getCurrentCallId()
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto call = LRCInstance::getCallInfoForConversation(conversation);
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid());
auto call = LRCInstance::getCallInfoForConversation(convInfo);
if (!call)
return QString();
return call->id;

View file

@ -19,6 +19,7 @@
#pragma once
#include "utils.h"
#include "lrcinstance.h"
#include <QImage>
#include <QQuickImageProvider>
@ -57,9 +58,8 @@ public:
return Utils::accountPhoto(LRCInstance::accountModel().getAccountInfo(idContent),
requestedSize);
} else if (idType == "conversation") {
auto* convModel = LRCInstance::getCurrentAccountInfo().conversationModel.get();
const auto& conv = convModel->getConversationForUID(idContent);
return Utils::contactPhoto(conv.participants[0], requestedSize);
const auto& convInfo = LRCInstance::getConversationFromConvUid(idContent);
return Utils::contactPhoto(convInfo.participants[0], requestedSize);
} else if (idType == "contact") {
return Utils::contactPhoto(idContent, requestedSize);
} else if (idType == "fallback") {

View file

@ -1,4 +1,4 @@
/*
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
@ -37,19 +37,21 @@ CallAdapter::CallAdapter(QObject* parent)
connect(&LRCInstance::behaviorController(),
&BehaviorController::showIncomingCallView,
this,
&CallAdapter::slotShowIncomingCallView);
connect(&LRCInstance::instance(),
&LRCInstance::currentAccountChanged,
this,
&CallAdapter::slotAccountChanged);
&CallAdapter::onShowIncomingCallView);
connect(&LRCInstance::behaviorController(),
&BehaviorController::showCallView,
this,
&CallAdapter::slotShowCallView);
&CallAdapter::onShowCallView);
connect(&LRCInstance::instance(),
&LRCInstance::currentAccountChanged,
this,
&CallAdapter::onAccountChanged);
}
void
CallAdapter::slotAccountChanged()
CallAdapter::onAccountChanged()
{
accountId_ = LRCInstance::getCurrAccId();
connectCallModel(accountId_);
@ -76,8 +78,7 @@ CallAdapter::placeCall()
void
CallAdapter::hangUpACall(const QString& accountId, const QString& convUid)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (!convInfo.uid.isEmpty()) {
LRCInstance::getAccountInfo(accountId).callModel->hangUp(convInfo.callId);
}
@ -86,8 +87,7 @@ CallAdapter::hangUpACall(const QString& accountId, const QString& convUid)
void
CallAdapter::refuseACall(const QString& accountId, const QString& convUid)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (!convInfo.uid.isEmpty()) {
LRCInstance::getAccountInfo(accountId).callModel->refuse(convInfo.callId);
}
@ -96,8 +96,7 @@ CallAdapter::refuseACall(const QString& accountId, const QString& convUid)
void
CallAdapter::acceptACall(const QString& accountId, const QString& convUid)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (!convInfo.uid.isEmpty()) {
LRCInstance::getAccountInfo(accountId).callModel->accept(convInfo.callId);
auto& accInfo = LRCInstance::getAccountInfo(convInfo.accountId);
@ -118,11 +117,14 @@ CallAdapter::acceptACall(const QString& accountId, const QString& convUid)
}
void
CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversation::Info& convInfo)
CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& convUid)
{
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return;
}
auto selectedAccountId = LRCInstance::getCurrAccId();
auto* callModel = LRCInstance::getCurrentCallModel();
auto* convModel = LRCInstance::getCurrentConversationModel();
if (!callModel->hasCall(convInfo.callId)) {
if (QApplication::focusObject() == nullptr || accountId != selectedAccountId) {
@ -130,8 +132,8 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
return;
}
const auto currentConvUid = LRCInstance::getCurrentConvUid();
const auto currentConvInfo = convModel->getConversationForUID(currentConvUid);
const auto& currentConvInfo = LRCInstance::getConversationFromConvUid(
LRCInstance::getCurrentConvUid());
// Current call
auto currentConvHasCall = callModel->hasCall(currentConvInfo.callId);
@ -164,8 +166,8 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
return;
}
const auto currentConvUid = LRCInstance::getCurrentConvUid();
const auto currentConvInfo = convModel->getConversationForUID(currentConvUid);
const auto& currentConvInfo = LRCInstance::getConversationFromConvUid(
LRCInstance::getCurrentConvUid());
// Call in current conversation
auto currentConvHasCall = callModel->hasCall(currentConvInfo.callId);
@ -202,8 +204,12 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
}
void
CallAdapter::slotShowCallView(const QString& accountId, const lrc::api::conversation::Info& convInfo)
CallAdapter::onShowCallView(const QString& accountId, const QString& convUid)
{
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return;
}
updateCall(convInfo.uid, accountId);
}
@ -213,8 +219,7 @@ CallAdapter::updateCall(const QString& convUid, const QString& accountId, bool f
accountId_ = accountId.isEmpty() ? accountId_ : accountId;
convUid_ = convUid.isEmpty() ? convUid_ : convUid;
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (convInfo.uid.isEmpty()) {
return;
}
@ -238,8 +243,8 @@ bool
CallAdapter::shouldShowPreview(bool force)
{
bool shouldShowPreview {false};
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (convInfo.uid.isEmpty()) {
return shouldShowPreview;
}
@ -255,8 +260,7 @@ QVariantList
CallAdapter::getConferencesInfos()
{
QVariantList map;
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (convInfo.uid.isEmpty())
return map;
auto callId = convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
@ -299,18 +303,20 @@ void
CallAdapter::showNotification(const QString& accountId, const QString& convUid)
{
QString from {};
auto convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (!accountId.isEmpty() && !convInfo.uid.isEmpty()) {
auto& accInfo = LRCInstance::getAccountInfo(accountId);
if (!convInfo.participants.isEmpty())
from = accInfo.contactModel->bestNameForContact(convInfo.participants[0]);
}
auto onClicked = [this, convInfo]() {
emit LRCInstance::instance().notificationClicked();
if (!convInfo.uid.isEmpty()) {
emit callSetupMainViewRequired(convInfo.accountId, convInfo.uid);
auto onClicked = [this, accountId, convUid = convInfo.uid]() {
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return;
}
emit LRCInstance::instance().notificationClicked();
emit callSetupMainViewRequired(convInfo.accountId, convInfo.uid);
};
emit LRCInstance::instance().updateSmartList();
Utils::showNotification(tr("is calling you"), from, accountId, convUid, onClicked);
@ -331,7 +337,7 @@ CallAdapter::connectCallModel(const QString& accountId)
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId);
auto& callModel = accInfo.callModel;
auto call = callModel->getCall(confId);
const auto convInfo = LRCInstance::getConversationFromCallId(confId);
const auto& convInfo = LRCInstance::getConversationFromCallId(confId);
bool currentMuted = false;
if (!convInfo.uid.isEmpty()) {
// Convert to QML
@ -371,8 +377,7 @@ CallAdapter::connectCallModel(const QString& accountId)
}
// Link local mute to conference mute
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (!convInfo.uid.isEmpty()) {
auto call = LRCInstance::getCallInfoForConversation(convInfo);
if (call) {
@ -397,7 +402,7 @@ CallAdapter::connectCallModel(const QString& accountId)
/*
* Change status label text.
*/
const auto convInfo = LRCInstance::getConversationFromCallId(callId);
const auto& convInfo = LRCInstance::getConversationFromCallId(callId);
if (!convInfo.uid.isEmpty()) {
emit callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid);
updateCallOverlay(convInfo);
@ -439,7 +444,7 @@ CallAdapter::connectCallModel(const QString& accountId)
}
auto currentCall = callModel->getCall(callId);
if (currentCall.status == lrc::api::call::Status::IN_PROGRESS) {
auto otherConv = LRCInstance::getConversationFromCallId(callId);
const auto& otherConv = LRCInstance::getConversationFromCallId(callId);
if (!otherConv.uid.isEmpty() && otherConv.uid != convInfo.uid) {
/*
* Reset the call view corresponding accountId, uid.
@ -454,7 +459,7 @@ CallAdapter::connectCallModel(const QString& accountId)
}
case lrc::api::call::Status::CONNECTED:
case lrc::api::call::Status::IN_PROGRESS: {
const auto convInfo = LRCInstance::getConversationFromCallId(callId, accountId);
const auto& convInfo = LRCInstance::getConversationFromCallId(callId, accountId);
if (!convInfo.uid.isEmpty() && convInfo.uid == LRCInstance::getCurrentConvUid()) {
accInfo.conversationModel->selectConversation(convInfo.uid);
}
@ -517,7 +522,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
oneSecondTimer_->start(20);
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
auto call = LRCInstance::getCallInfoForConversation(convInfo);
auto* call = LRCInstance::getCallInfoForConversation(convInfo);
if (!call) {
return;
}
@ -544,7 +549,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
void
CallAdapter::hangupCall(const QString& uri)
{
const auto convInfo = LRCInstance::getConversationFromPeerUri(uri, accountId_);
const auto& convInfo = LRCInstance::getConversationFromPeerUri(uri, accountId_);
if (!convInfo.uid.isEmpty()) {
auto callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
if (callModel->hasCall(convInfo.callId)) {
@ -571,11 +576,12 @@ void
CallAdapter::maximizeParticipant(const QString& uri)
{
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid(),
accountId_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
auto call = callModel->getCall(confId);
if (call.participantsInfos.size() > 0) {
@ -603,12 +609,12 @@ void
CallAdapter::minimizeParticipant(const QString& uri)
{
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid(),
accountId_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
auto call = callModel->getCall(confId);
if (call.participantsInfos.size() > 0) {
@ -633,8 +639,7 @@ CallAdapter::minimizeParticipant(const QString& uri)
void
CallAdapter::hangUpThisCall()
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_, accountId_);
if (!convInfo.uid.isEmpty()) {
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
if (!convInfo.confId.isEmpty() && callModel->hasCall(convInfo.confId)) {
@ -648,9 +653,8 @@ CallAdapter::hangUpThisCall()
bool
CallAdapter::isRecordingThisCall()
{
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_, accountId_);
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
auto& convModel = accInfo.conversationModel;
const auto convInfo = convModel->getConversationForUID(convUid_);
return accInfo.callModel->isRecording(convInfo.confId)
|| accInfo.callModel->isRecording(convInfo.callId);
}
@ -658,8 +662,7 @@ CallAdapter::isRecordingThisCall()
bool
CallAdapter::isCurrentHost() const
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_, accountId_);
if (!convInfo.uid.isEmpty()) {
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
try {
@ -681,8 +684,7 @@ CallAdapter::isCurrentHost() const
bool
CallAdapter::participantIsHost(const QString& uri) const
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (!convInfo.uid.isEmpty()) {
auto& accInfo = LRCInstance::getAccountInfo(accountId_);
auto* callModel = accInfo.callModel.get();
@ -704,11 +706,11 @@ bool
CallAdapter::isModerator(const QString& uri) const
{
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
return callModel->isModerator(confId, uri);
} catch (...) {
@ -719,8 +721,7 @@ CallAdapter::isModerator(const QString& uri) const
bool
CallAdapter::isCurrentModerator() const
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
if (!convInfo.uid.isEmpty()) {
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
try {
@ -745,11 +746,10 @@ void
CallAdapter::setModerator(const QString& uri, const bool state)
{
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
callModel->setModerator(confId, uri, state);
} catch (...) {
@ -760,11 +760,11 @@ void
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());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
const auto call = callModel->getCall(confId);
callModel->muteParticipant(confId, uri, state);
@ -775,8 +775,7 @@ CallAdapter::muteParticipant(const QString& uri, const bool state)
bool
CallAdapter::isMuted(const QString& uri) const
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(convUid_);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto confId = convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
try {
@ -799,11 +798,11 @@ void
CallAdapter::hangupParticipant(const QString& uri)
{
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
auto confId = conversation.confId;
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid_);
auto confId = convInfo.confId;
if (confId.isEmpty())
confId = conversation.callId;
confId = convInfo.callId;
try {
const auto call = callModel->getCall(confId);
callModel->hangupParticipant(confId, uri);

View file

@ -1,4 +1,4 @@
/*
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
@ -99,10 +99,9 @@ signals:
void remoteRecordingChanged(const QStringList& peers, bool state);
public slots:
void slotShowIncomingCallView(const QString& accountId,
const lrc::api::conversation::Info& convInfo);
void slotShowCallView(const QString& accountId, const lrc::api::conversation::Info& convInfo);
void slotAccountChanged();
void onShowIncomingCallView(const QString& accountId, const QString& convUid);
void onShowCallView(const QString& accountId, const QString& convUid);
void onAccountChanged();
private:
bool shouldShowPreview(bool force);

View file

@ -35,10 +35,7 @@ ContactAdapter::getContactSelectableModel(int type)
* Called from qml every time contact picker refreshes.
*/
listModeltype_ = static_cast<SmartListModel::Type>(type);
smartListModel_.reset(new SmartListModel(this,
LRCInstance::getCurrAccId(),
listModeltype_,
LRCInstance::getCurrentConvUid()));
smartListModel_.reset(new SmartListModel(this, listModeltype_));
selectableProxyModel_->setSourceModel(smartListModel_.get());
/*
@ -90,9 +87,7 @@ ContactAdapter::contactSelected(int index)
{
auto contactIndex = selectableProxyModel_->index(index, 0);
auto* callModel = LRCInstance::getCurrentCallModel();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid());
if (contactIndex.isValid()) {
switch (listModeltype_) {
case SmartListModel::Type::CONFERENCE: {
@ -111,16 +106,15 @@ ContactAdapter::contactSelected(int index)
const auto callId = LRCInstance::getCallIdForConversationUid(convUid, accId);
if (!callId.isEmpty()) {
if (conversation.uid.isEmpty()) {
if (convInfo.uid.isEmpty()) {
return;
}
auto thisCallId = conversation.confId.isEmpty() ? conversation.callId
: conversation.confId;
auto thisCallId = convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
callModel->joinCalls(thisCallId, callId);
} else {
const auto contactUri = contactIndex.data(SmartListModel::Role::URI).value<QString>();
auto call = LRCInstance::getCallInfoForConversation(conversation);
auto call = LRCInstance::getCallInfoForConversation(convInfo);
if (!call) {
return;
}
@ -133,11 +127,10 @@ ContactAdapter::contactSelected(int index)
*/
const auto contactUri = contactIndex.data(SmartListModel::Role::URI).value<QString>();
if (conversation.uid.isEmpty()) {
if (convInfo.uid.isEmpty()) {
return;
}
const auto callId = conversation.confId.isEmpty() ? conversation.callId
: conversation.confId;
const auto callId = convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
QString destCallId;

View file

@ -1,7 +1,7 @@
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Anthony Lonard <anthony.leonard@savoirfairelinux.com>
* Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
* Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
* Author: Isa Nanic <isa.nanic@savoirfairelinux.com>
@ -39,14 +39,14 @@ ConversationsAdapter::ConversationsAdapter(QObject* parent)
void
ConversationsAdapter::safeInit()
{
conversationSmartListModel_ = new SmartListModel(this, LRCInstance::getCurrAccId());
conversationSmartListModel_ = new SmartListModel(this);
emit modelChanged(QVariant::fromValue(conversationSmartListModel_));
connect(&LRCInstance::behaviorController(),
&BehaviorController::showChatView,
[this](const QString& accountId, lrc::api::conversation::Info convInfo) {
emit showConversation(accountId, convInfo.uid);
[this](const QString& accountId, const QString& convId) {
emit showConversation(accountId, convId);
});
connect(&LRCInstance::behaviorController(),
@ -75,13 +75,16 @@ ConversationsAdapter::backToWelcomePage()
void
ConversationsAdapter::selectConversation(const QString& accountId, const QString& convUid)
{
auto* convModel = LRCInstance::getAccountInfo(accountId).conversationModel.get();
const auto& convInfo = convModel->getConversationForUID(convUid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (LRCInstance::getCurrentConvUid() != convInfo.uid && convInfo.participants.size() > 0) {
// If the account is not currently selected, do that first, then
// proceed to select the conversation.
auto selectConversation = [this, convInfo] {
auto selectConversation = [this, accountId, convUid = convInfo.uid] {
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return;
}
auto& accInfo = LRCInstance::getAccountInfo(convInfo.accountId);
LRCInstance::setSelectedConvId(convInfo.uid);
accInfo.conversationModel->clearUnreadInteractions(convInfo.uid);
@ -143,11 +146,10 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
&& (!QApplication::focusWindow() || accountId != LRCInstance::getCurrAccId()
|| convUid != LRCInstance::getCurrentConvUid())) {
auto& accInfo = LRCInstance::getAccountInfo(accountId);
auto& contact = accInfo.contactModel->getContact(interaction.authorUri);
auto from = accInfo.contactModel->bestNameForContact(interaction.authorUri);
auto onClicked = [this, accountId, convUid, uri = interaction.authorUri] {
emit LRCInstance::instance().notificationClicked();
auto convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (!convInfo.uid.isEmpty()) {
selectConversation(accountId, convInfo.uid);
emit LRCInstance::instance().updateSmartList();
@ -185,24 +187,25 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
auto currentConversationModel = LRCInstance::getCurrentConversationModel();
modelSortedConnection_ = QObject::connect(
currentConversationModel, &lrc::api::ConversationModel::modelSorted, [this]() {
currentConversationModel, &lrc::api::ConversationModel::modelChanged, [this]() {
conversationSmartListModel_->fillConversationsList();
updateConversationsFilterWidget();
emit updateListViewRequested();
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(
const auto& convInfo = LRCInstance::getConversationFromConvUid(
LRCInstance::getCurrentConvUid());
if (conversation.uid.isEmpty() || conversation.participants.isEmpty()) {
if (convInfo.uid.isEmpty() || convInfo.participants.isEmpty()) {
return;
}
const auto contactURI = conversation.participants[0];
const auto contactURI = convInfo.participants[0];
if (contactURI.isEmpty()
|| convModel->owner.contactModel->getContact(contactURI).profileInfo.type
== lrc::api::profile::Type::TEMPORARY) {
return;
}
emit modelSorted(QVariant::fromValue(conversation.uid));
emit modelSorted(QVariant::fromValue(convInfo.uid));
});
contactProfileUpdatedConnection_
@ -215,9 +218,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
modelUpdatedConnection_ = QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::conversationUpdated,
[this](const QString& convUid) {
conversationSmartListModel_->updateConversation(
convUid);
[this](const QString&) {
updateConversationsFilterWidget();
emit updateListViewRequested();
});
@ -309,13 +310,13 @@ ConversationsAdapter::updateConversationForNewContact(const QString& convUid)
if (convModel == nullptr) {
return;
}
const auto selectedUid = LRCInstance::getCurrentConvUid();
const auto conversation = convModel->getConversationForUID(convUid);
if (!conversation.uid.isEmpty() && !conversation.participants.isEmpty()) {
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid);
if (!convInfo.uid.isEmpty() && !convInfo.participants.isEmpty()) {
try {
const auto contact = convModel->owner.contactModel->getContact(
conversation.participants[0]);
if (!contact.profileInfo.uri.isEmpty() && contact.profileInfo.uri == selectedUid) {
const auto contact = convModel->owner.contactModel->getContact(convInfo.participants[0]);
if (!contact.profileInfo.uri.isEmpty()
&& contact.profileInfo.uri == LRCInstance::getCurrentConvUid()) {
LRCInstance::setSelectedConvId(convUid);
convModel->selectConversation(convUid);
}

View file

@ -169,8 +169,7 @@ public:
static QString getCallIdForConversationUid(const QString& convUid, const QString& accountId)
{
auto& accInfo = LRCInstance::getAccountInfo(accountId);
auto convInfo = accInfo.conversationModel->getConversationForUID(convUid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return {};
}
@ -208,68 +207,31 @@ public:
}
}
static const conversation::Info& getConversation(const QString& accountId,
getConvPredicate pred = {},
bool filtered = false)
{
using namespace lrc::api;
static conversation::Info invalid = {};
try {
auto& accInfo = LRCInstance::getAccountInfo(accountId);
auto& convModel = accInfo.conversationModel;
if (filtered) {
auto& convs = convModel->allFilteredConversations();
auto conv = std::find_if(convs.begin(), convs.end(), pred);
if (conv != convs.end()) {
return *conv;
}
} else {
for (int i = static_cast<int>(profile::Type::RING);
i <= static_cast<int>(profile::Type::TEMPORARY);
++i) {
auto filter = static_cast<profile::Type>(i);
auto& convs = convModel->getFilteredConversations(filter);
auto conv = std::find_if(convs.begin(), convs.end(), pred);
if (conv != convs.end()) {
return *conv;
}
}
}
} catch (...) {
}
return invalid;
}
static const conversation::Info& getConversationFromConvUid(const QString& convUid,
const QString& accountId = {},
bool filtered = false)
const QString& accountId = {})
{
return getConversation(
!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool { return convUid == conv.uid; },
filtered);
}
static const conversation::Info& getConversationFromCallId(const QString& callId,
const QString& accountId = {},
bool filtered = false)
{
return getConversation(
!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool {
return callId == conv.callId or callId == conv.confId;
},
filtered);
auto& accInfo = LRCInstance::accountModel().getAccountInfo(
!accountId.isEmpty() ? accountId : getCurrAccId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForUid(convUid).value_or(instance().invalid);
}
static const conversation::Info& getConversationFromPeerUri(const QString& peerUri,
const QString& accountId = {},
bool filtered = false)
const QString& accountId = {})
{
return getConversation(
!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool { return peerUri == conv.participants[0]; },
filtered);
auto& accInfo = LRCInstance::accountModel().getAccountInfo(
!accountId.isEmpty() ? accountId : getCurrAccId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForPeerUri(peerUri).value_or(instance().invalid);
}
static const conversation::Info& getConversationFromCallId(const QString& callId,
const QString& accountId = {})
{
auto& accInfo = LRCInstance::accountModel().getAccountInfo(
!accountId.isEmpty() ? accountId : getCurrAccId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForCallId(callId).value_or(instance().invalid);
}
static ConversationModel* getCurrentConversationModel()
@ -469,5 +431,7 @@ private:
QString selectedConvUid_;
MapStringString contentDrafts_;
MapStringString lastConferences_;
conversation::Info invalid {};
};
Q_DECLARE_METATYPE(LRCInstance*)

View file

@ -51,17 +51,17 @@ MessagesAdapter::safeInit()
}
void
MessagesAdapter::setupChatView(const QString& uid)
MessagesAdapter::setupChatView(const QString& convUid)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
if (convModel == nullptr) {
return;
}
if (currentConvUid_ == uid)
if (currentConvUid_ == convUid)
return;
const auto& convInfo = convModel->getConversationForUID(uid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(convUid);
if (convInfo.uid.isEmpty() || convInfo.participants.isEmpty()) {
return;
}
@ -93,11 +93,11 @@ MessagesAdapter::setupChatView(const QString& uid)
contactIsComposing(convInfo.uid, "", false);
connect(LRCInstance::getCurrentConversationModel(),
&ConversationModel::composingStatusChanged,
[this](const QString& uid, const QString& contactUri, bool isComposing) {
[this](const QString& convUid, const QString& contactUri, bool isComposing) {
if (!AppSettingsManager::getValue(Settings::Key::EnableTypingIndicator).toBool()) {
return;
}
contactIsComposing(uid, contactUri, isComposing);
contactIsComposing(convUid, contactUri, isComposing);
});
/*
@ -110,7 +110,7 @@ MessagesAdapter::setupChatView(const QString& uid)
requestSendMessageContent();
currentConvUid_ = uid;
currentConvUid_ = convUid;
}
void
@ -167,11 +167,11 @@ void
MessagesAdapter::updateConversationForAddedContact()
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid());
clear();
setConversationProfileData(conversation);
printHistory(*convModel, conversation.interactions);
setConversationProfileData(convInfo);
printHistory(*convModel, convInfo.interactions);
}
void
@ -205,7 +205,7 @@ void
MessagesAdapter::slotMessagesCleared()
{
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
const auto& convInfo = LRCInstance::getConversationFromConvUid(LRCInstance::getCurrentConvUid());
printHistory(*convModel, convInfo.interactions);
@ -442,15 +442,13 @@ MessagesAdapter::onComposing(bool isComposing)
void
MessagesAdapter::setConversationProfileData(const lrc::api::conversation::Info& convInfo)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
auto accInfo = &LRCInstance::getCurrentAccountInfo();
const auto conv = convModel->getConversationForUID(convInfo.uid);
if (conv.participants.isEmpty()) {
if (convInfo.participants.isEmpty()) {
return;
}
auto contactUri = conv.participants.front();
auto contactUri = convInfo.participants.front();
if (contactUri.isEmpty()) {
return;
}

View file

@ -54,9 +54,7 @@ public:
/*
* For contact_xxx, xxx is "" initially
*/
auto convModel = LRCInstance::getCurrentConversationModel();
auto convInfo = convModel->getConversationForUID(list[1]);
const auto& convInfo = LRCInstance::getConversationFromConvUid(list[1]);
auto contact = LRCInstance::getCurrentAccountInfo().contactModel->getContact(
convInfo.participants.at(0));
return QPair(QrType::Contact, contact.profileInfo.uri);

View file

@ -115,6 +115,7 @@ SettingsAdapter::getResolutions(const QString& device)
auto channelCaps = get_ResRateList(currentChannel, device);
for (auto [resolution, frameRateList] : channelCaps) {
for (auto rate : frameRateList) {
(void) rate;
resolutions.append(resolution);
}
}

View file

@ -1,4 +1,4 @@
/*
/*!
* Copyright (C) 2017-2020 by Savoir-faire Linux
* Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@ -25,10 +25,7 @@
#include <QDateTime>
SmartListModel::SmartListModel(QObject* parent,
const QString& accId,
SmartListModel::Type listModelType,
const QString& convUid)
SmartListModel::SmartListModel(QObject* parent, SmartListModel::Type listModelType)
: QAbstractListModel(parent)
, listModelType_(listModelType)
{
@ -79,20 +76,20 @@ SmartListModel::data(const QModelIndex& index, int role) const
}
try {
auto& accountInfo = LRCInstance::accountModel().getAccountInfo(LRCInstance::getCurrAccId());
auto& convModel = accountInfo.conversationModel;
lrc::api::conversation::Info item;
auto& currentAccountInfo = LRCInstance::accountModel().getAccountInfo(
LRCInstance::getCurrAccId());
auto& convModel = currentAccountInfo.conversationModel;
if (listModelType_ == Type::TRANSFER) {
auto filterType = accountInfo.profileInfo.type;
item = convModel->getFilteredConversations(filterType).at(index.row());
return getConversationItemData(item, accountInfo, role);
auto filterType = currentAccountInfo.profileInfo.type;
auto& item = convModel->getFilteredConversations(filterType).at(index.row());
return getConversationItemData(item, currentAccountInfo, role);
} else if (listModelType_ == Type::CONFERENCE) {
auto calls = conferenceables_[ConferenceableItem::CALL];
auto contacts = conferenceables_[ConferenceableItem::CONTACT];
QString itemConvUid {}, itemAccId {};
QString itemConvUid {}, itemAccountId {};
if (calls.size() == 0) {
itemConvUid = contacts.at(index.row()).at(0).convId;
itemAccId = contacts.at(index.row()).at(0).accountId;
itemAccountId = contacts.at(index.row()).at(0).accountId;
} else {
bool callsOpen = sectionState_[tr("Calls")];
bool contactsOpen = sectionState_[tr("Contacts")];
@ -107,7 +104,7 @@ SmartListModel::data(const QModelIndex& index, int role) const
} else {
auto idx = index.row() - 1;
itemConvUid = calls.at(idx).at(0).convId;
itemAccId = calls.at(idx).at(0).accountId;
itemAccountId = calls.at(idx).at(0).accountId;
}
} else if (index.row() < contactSectionEnd) {
if (index.row() == callSectionEnd) {
@ -117,20 +114,20 @@ SmartListModel::data(const QModelIndex& index, int role) const
} else {
auto idx = index.row() - (callSectionEnd + 1);
itemConvUid = contacts.at(idx).at(0).convId;
itemAccId = contacts.at(idx).at(0).accountId;
itemAccountId = contacts.at(idx).at(0).accountId;
}
}
}
if (role == Role::AccountId) {
return QVariant(itemAccId);
return QVariant(itemAccountId);
}
auto& itemAccountInfo = LRCInstance::accountModel().getAccountInfo(itemAccId);
item = itemAccountInfo.conversationModel->getConversationForUID(itemConvUid);
auto& itemAccountInfo = LRCInstance::accountModel().getAccountInfo(itemAccountId);
auto& item = LRCInstance::getConversationFromConvUid(itemConvUid, itemAccountId);
return getConversationItemData(item, itemAccountInfo, role);
} else if (listModelType_ == Type::CONVERSATION) {
item = conversations_.at(index.row());
return getConversationItemData(item, accountInfo, role);
auto& item = conversations_.at(index.row());
return getConversationItemData(item, currentAccountInfo, role);
}
} catch (const std::exception& e) {
qWarning() << e.what();
@ -182,30 +179,12 @@ SmartListModel::fillConversationsList()
fillContactAvatarUidMap(LRCInstance::getCurrentAccountInfo().contactModel->getAllContacts());
auto* convModel = LRCInstance::getCurrentConversationModel();
conversations_.clear();
for (auto convSearch : convModel->getAllSearchResults()) {
conversations_.emplace_back(convSearch);
}
for (auto convFilt : convModel->allFilteredConversations()) {
conversations_.emplace_back(convFilt);
}
using ConversationList = ConversationModel::ConversationQueueProxy;
conversations_ = ConversationList(convModel->getAllSearchResults())
+ convModel->allFilteredConversations();
endResetModel();
}
void
SmartListModel::updateConversation(const QString& convUid)
{
auto* convModel = LRCInstance::getCurrentConversationModel();
for (lrc::api::conversation::Info& conversation : conversations_) {
if (conversation.uid == convUid) {
conversation = convModel->getConversationForUID(convUid);
return;
}
}
}
void
SmartListModel::updateContactAvatarUid(const QString& contactUri)
{
@ -336,8 +315,7 @@ SmartListModel::getConversationItemData(const conversation::Info& item,
case Role::UID:
return QVariant(item.uid);
case Role::InCall: {
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(item.uid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(item.uid);
if (!convInfo.uid.isEmpty()) {
auto* callModel = LRCInstance::getCurrentCallModel();
return QVariant(callModel->hasCall(convInfo.callId));
@ -345,8 +323,7 @@ SmartListModel::getConversationItemData(const conversation::Info& item,
return QVariant(false);
}
case Role::IsAudioOnly: {
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(item.uid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(item.uid);
if (!convInfo.uid.isEmpty()) {
auto* call = LRCInstance::getCallInfoForConversation(convInfo);
if (call) {
@ -356,11 +333,10 @@ SmartListModel::getConversationItemData(const conversation::Info& item,
return QVariant();
}
case Role::CallStackViewShouldShow: {
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(item.uid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(item.uid);
if (!convInfo.uid.isEmpty()) {
auto* callModel = LRCInstance::getCurrentCallModel();
const auto call = callModel->getCall(convInfo.callId);
const auto& call = callModel->getCall(convInfo.callId);
return QVariant(
callModel->hasCall(convInfo.callId)
&& ((!call.isOutgoing
@ -372,11 +348,9 @@ SmartListModel::getConversationItemData(const conversation::Info& item,
return QVariant(false);
}
case Role::CallState: {
auto* convModel = LRCInstance::getCurrentConversationModel();
const auto convInfo = convModel->getConversationForUID(item.uid);
const auto& convInfo = LRCInstance::getConversationFromConvUid(item.uid);
if (!convInfo.uid.isEmpty()) {
auto* call = LRCInstance::getCallInfoForConversation(convInfo);
if (call) {
if (auto* call = LRCInstance::getCallInfoForConversation(convInfo)) {
return QVariant(static_cast<int>(call->status));
}
}

View file

@ -64,9 +64,7 @@ public:
Q_ENUM(Role)
explicit SmartListModel(QObject* parent = 0,
const QString& accId = {},
SmartListModel::Type listModelType = Type::CONVERSATION,
const QString& convUid = {});
SmartListModel::Type listModelType = Type::CONVERSATION);
~SmartListModel();
/*
@ -76,15 +74,16 @@ public:
int columnCount(const QModelIndex& parent) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex& child) const;
Qt::ItemFlags flags(const QModelIndex& index) const;
QModelIndex index(int row,
int column = 0,
const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
Q_INVOKABLE void setConferenceableFilter(const QString& filter = {});
Q_INVOKABLE void toggleSection(const QString& section);
Q_INVOKABLE int currentUidSmartListModelIndex();
Q_INVOKABLE void fillConversationsList();
Q_INVOKABLE void updateConversation(const QString& conv);
/*
* This function is to update contact avatar uuid for current account when there's an contact
@ -109,5 +108,5 @@ private:
QMap<QString, bool> sectionState_;
QMap<ConferenceableItem, ConferenceableValue> conferenceables_;
QMap<QString, QString> contactAvatarUidMap_;
ConversationModel::ConversationQueue conversations_;
ConversationModel::ConversationQueueProxy conversations_;
};

View file

@ -1,4 +1,4 @@
/*
/*!
* Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@ -103,7 +103,7 @@ UtilsAdapter::checkStartupLink()
const QString
UtilsAdapter::getBestName(const QString& accountId, const QString& uid)
{
auto conv = LRCInstance::getConversationFromConvUid(uid);
const auto& conv = LRCInstance::getConversationFromConvUid(uid);
if (!conv.participants.isEmpty())
return LRCInstance::getAccountInfo(accountId).contactModel->bestNameForContact(
conv.participants[0]);
@ -121,7 +121,7 @@ UtilsAdapter::getBestId(const QString& accountId)
const QString
UtilsAdapter::getBestId(const QString& accountId, const QString& uid)
{
auto conv = LRCInstance::getConversationFromConvUid(uid);
const auto& conv = LRCInstance::getConversationFromConvUid(uid);
if (!conv.participants.isEmpty())
return LRCInstance::getAccountInfo(accountId).contactModel->bestIdForContact(
conv.participants[0]);
@ -134,12 +134,12 @@ UtilsAdapter::getTotalUnreadMessages()
int totalUnreadMessages {0};
if (LRCInstance::getCurrentAccountInfo().profileInfo.type != lrc::api::profile::Type::SIP) {
auto* convModel = LRCInstance::getCurrentConversationModel();
auto ringConversations = convModel->getFilteredConversations(lrc::api::profile::Type::RING);
std::for_each(ringConversations.begin(),
ringConversations.end(),
[&totalUnreadMessages](const auto& conversation) {
totalUnreadMessages += conversation.unreadMessages;
});
auto ringConversations = convModel->getFilteredConversations(lrc::api::profile::Type::RING,
false);
ringConversations.for_each(
[&totalUnreadMessages](const lrc::api::conversation::Info& conversation) {
totalUnreadMessages += conversation.unreadMessages;
});
}
return totalUnreadMessages;
}
@ -197,7 +197,7 @@ void
UtilsAdapter::setCurrentCall(const QString& accountId, const QString& convUid)
{
auto& accInfo = LRCInstance::getAccountInfo(accountId);
const auto convInfo = accInfo.conversationModel->getConversationForUID(convUid);
auto const& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
accInfo.callModel->setCurrentCall(convInfo.callId);
}
@ -230,19 +230,16 @@ UtilsAdapter::getCallConvForAccount(const QString& accountId)
const QString
UtilsAdapter::getCallId(const QString& accountId, const QString& convUid)
{
auto& accInfo = LRCInstance::getAccountInfo(accountId);
const auto convInfo = accInfo.conversationModel->getConversationForUID(convUid);
auto const& convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.isEmpty()) {
return "";
return {};
}
auto call = LRCInstance::getCallInfoForConversation(convInfo, false);
if (!call) {
return "";
if (auto* call = LRCInstance::getCallInfoForConversation(convInfo, false)) {
return call->id;
}
return call->id;
return {};
}
int