Refactor some code around connection handling

This commit is contained in:
Tobias Fella
2024-01-07 21:28:41 +01:00
parent 4926488d49
commit d45aa14348
2 changed files with 6 additions and 13 deletions

View File

@@ -17,6 +17,7 @@
#include <Quotient/csapi/content-repo.h>
#include <Quotient/csapi/profile.h>
#include <Quotient/database.h>
#include <Quotient/jobs/downloadfilejob.h>
#include <Quotient/qt_connection_util.h>
#include <Quotient/settings.h>
#include <Quotient/user.h>
@@ -49,6 +50,11 @@ NeoChatConnection::NeoChatConnection(QObject *parent)
Q_EMIT userConsentRequired(job->errorUrl());
}
});
connect(this, &NeoChatConnection::requestFailed, this, [](BaseJob *job) {
if (dynamic_cast<DownloadFileJob *>(job) && job->jsonData()["errcode"_ls].toString() == "M_TOO_LARGE"_ls) {
RoomManager::instance().warning(i18n("File too large to download."), i18n("Contact your matrix server administrator for support."));
}
});
}
NeoChatConnection::NeoChatConnection(const QUrl &server, QObject *parent)