1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-31 12:13:36 +02:00

messagesadapter: use acceptConversationRequest api

To accept incoming requests, a new acceptConversationRequest api
should be used and makePermanent is now only called for outgoing
requests.

Change-Id: I70bcfc0e323ae250641420f4fda91c6987cac720
This commit is contained in:
Andreas Traczyk 2021-06-25 14:33:56 -04:00 committed by Sébastien Blin
parent 2865b3841f
commit 8409355e93
3 changed files with 10 additions and 7 deletions

View file

@ -116,7 +116,8 @@ ConversationsAdapter::ConversationsAdapter(SystemTray* systemTray,
auto& convInfo = lrcInstance_->getConversationFromPeerUri(peerUri, accountId);
if (convInfo.uid.isEmpty())
return;
lrcInstance_->makeConversationPermanent(convInfo.uid, accountId);
auto* convModel = lrcInstance_->getAccountInfo(accountId).conversationModel;
convModel->acceptConversationRequest(convInfo.uid);
});
connect(systemTray_,
&SystemTray::refusePendingActivated,
@ -124,8 +125,8 @@ ConversationsAdapter::ConversationsAdapter(SystemTray* systemTray,
auto& convInfo = lrcInstance_->getConversationFromPeerUri(peerUri, accountId);
if (convInfo.uid.isEmpty())
return;
lrcInstance_->getAccountInfo(accountId).conversationModel->removeConversation(
convInfo.uid);
auto* convModel = lrcInstance_->getAccountInfo(accountId).conversationModel;
convModel->removeConversation(convInfo.uid);
});
#endif
}

View file

@ -440,7 +440,7 @@ LRCInstance::makeConversationPermanent(const QString& convId, const QString& acc
const auto& accInfo = accountModel().getAccountInfo(aId);
auto cId = convId.isEmpty() ? selectedConvUid_ : convId;
if (cId.isEmpty()) {
qWarning() << Q_FUNC_INFO << "no Id provided";
qWarning() << Q_FUNC_INFO << "no conversation to make permanent";
return;
}
accInfo.conversationModel.get()->makePermanent(cId);

View file

@ -715,10 +715,12 @@ MessagesAdapter::contactIsComposing(const QString& contactUri, bool isComposing)
}
void
MessagesAdapter::acceptInvitation(const QString& convUid)
MessagesAdapter::acceptInvitation(const QString& convId)
{
lrcInstance_->makeConversationPermanent(convUid);
if (convUid == currentConvUid_)
auto conversationId = convId.isEmpty() ? lrcInstance_->get_selectedConvUid() : convId;
auto* convModel = lrcInstance_->getCurrentConversationModel();
convModel->acceptConversationRequest(conversationId);
if (conversationId == currentConvUid_)
currentConvUid_.clear();
}