mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
messagesadapter: protect loadMoreMessages
Change-Id: I4a8d7105ed6ea5600fc4596f62b56991631358b8
This commit is contained in:
parent
be036ba6b7
commit
9d70fe10eb
1 changed files with 21 additions and 13 deletions
|
@ -91,27 +91,35 @@ MessagesAdapter::loadMoreMessages()
|
||||||
{
|
{
|
||||||
auto accountId = lrcInstance_->get_currentAccountId();
|
auto accountId = lrcInstance_->get_currentAccountId();
|
||||||
auto convId = lrcInstance_->get_selectedConvUid();
|
auto convId = lrcInstance_->get_selectedConvUid();
|
||||||
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convId, accountId);
|
try {
|
||||||
if (convInfo.isSwarm()) {
|
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convId, accountId);
|
||||||
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
if (convInfo.isSwarm()) {
|
||||||
convModel->loadConversationMessages(convId, loadChunkSize_);
|
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||||
|
convModel->loadConversationMessages(convId, loadChunkSize_);
|
||||||
|
}
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
qWarning() << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MessagesAdapter::loadConversationUntil(const QString& to)
|
MessagesAdapter::loadConversationUntil(const QString& to)
|
||||||
{
|
{
|
||||||
if (auto* model = messageListModel_.value<MessageListModel*>()) {
|
try {
|
||||||
auto idx = model->indexOfMessage(to);
|
if (auto* model = messageListModel_.value<MessageListModel*>()) {
|
||||||
if (idx == -1) {
|
auto idx = model->indexOfMessage(to);
|
||||||
auto accountId = lrcInstance_->get_currentAccountId();
|
if (idx == -1) {
|
||||||
auto convId = lrcInstance_->get_selectedConvUid();
|
auto accountId = lrcInstance_->get_currentAccountId();
|
||||||
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convId, accountId);
|
auto convId = lrcInstance_->get_selectedConvUid();
|
||||||
if (convInfo.isSwarm()) {
|
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convId, accountId);
|
||||||
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
if (convInfo.isSwarm()) {
|
||||||
convModel->loadConversationUntil(convId, to);
|
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||||
|
convModel->loadConversationUntil(convId, to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
qWarning() << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue