From b3008316ffceb9b0ab7c26ae9bb953a1969b8467 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 14 Dec 2024 12:04:10 +0100 Subject: [PATCH] ??? --- Quotient/connection.cpp | 15 +++++++++++++++ quotest/quotest.cpp | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Quotient/connection.cpp b/Quotient/connection.cpp index 872c6a3e..3001beec 100644 --- a/Quotient/connection.cpp +++ b/Quotient/connection.cpp @@ -335,6 +335,10 @@ inline QFuture runKeychainJob(QKeychain::Job* j, const QString& j->setAutoDelete(true); j->setKey(keychainId); auto ft = QtFuture::connect(j, &QKeychain::Job::finished); + qWarning() << "starting keychain job"; + QObject::connect(j, &QKeychain::Job::finished, j, [](){ + qWarning() << "finished keychain job"; + }); j->start(); return ft; } @@ -407,6 +411,7 @@ void Connection::Private::completeSetup(const QString& mxId, bool newLogin, const std::optional& deviceId, const std::optional& accessToken) { + qWarning() << "completeSetup"; q->setObjectName(data->userId() % u'/' % data->deviceId()); data->setIdentity(mxId, deviceId.value_or(u""_s), accessToken.value_or(u""_s).toLatin1()); qCDebug(MAIN) << "Using server" << data->baseUrl().toDisplayString() @@ -423,31 +428,41 @@ void Connection::Private::completeSetup(const QString& mxId, bool newLogin, q->loadCapabilities(); q->user()->load(); // Load the local user's profile } + qWarning() << "completeSetup 2"; auto doCompleteSetup = [this, mxId, deviceId, accessToken](){ + qWarning() << "completeSetup 3"; setupPicklingKey(); + qWarning() << "completeSetup 4"; emit q->stateChanged(); + qWarning() << useEncryption; if (useEncryption) { emit q->encryptionChanged(useEncryption); emit q->stateChanged(); emit q->ready(); + qWarning() << "compelteSetup 5"; emit q->connected(); } else { qCInfo(E2EE) << "End-to-end encryption (E2EE) support is off for" << q->objectName(); emit q->ready(); + qWarning() << "completeSetup 6"; emit q->connected(); } }; + qWarning() << "newLogin?" << newLogin; if (newLogin) { auto mxIdForDb = q->userId(); mxIdForDb.replace(u':', u'_'); const QString databasePath{ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) % u'/' % mxIdForDb % u'/' % q->deviceId() }; QDir(databasePath).removeRecursively(); + qWarning() << "running keychain job"; runKeychainJob(new QKeychain::DeletePasswordJob(qAppName()), q->userId() % u"-Pickle"_s).then([doCompleteSetup](const auto &) { + qWarning() << "doingcompeltesetup"; doCompleteSetup(); }); } else { + qWarning() << "also doing completesetup"; doCompleteSetup(); } } diff --git a/quotest/quotest.cpp b/quotest/quotest.cpp index c189f16d..a091c470 100644 --- a/quotest/quotest.cpp +++ b/quotest/quotest.cpp @@ -198,7 +198,9 @@ TestManager::TestManager(int& argc, char** argv) clog.flush(); // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) + qWarning() << "Connecting to connected"; connect(c, &Connection::connected, this, [this] { + qWarning() << "Connected"; if (QUO_ALARM(c->homeserver().isEmpty() || !c->homeserver().isValid()) || QUO_ALARM(c->domain() != c->userId().section(u':', 1))) { clog << "Connection information doesn't look right, " @@ -252,17 +254,21 @@ TestManager::TestManager(int& argc, char** argv) void TestManager::setupAndRun() { + qWarning() << 1; Q_ASSERT(!c->homeserver().isEmpty() && c->homeserver().isValid()); Q_ASSERT(c->domain() == c->userId().section(u':', 1)); clog << "Connected, server: " << c->homeserver().toDisplayString().toStdString() << '\n' << "Access token: " << c->accessToken().toStdString() << endl; + qWarning() << 2; connect(c, &Connection::loadedRoomState, this, &TestManager::onNewRoom); c->setLazyLoading(true); + qWarning() << 3; clog << "Joining " << targetRoomName.toStdString() << endl; c->joinAndGetRoom(targetRoomName).then(this, [this](Room* room) { + qWarning() << 4; if (!room) { clog << "Failed to join the test room" << endl; finalize(); @@ -965,7 +971,6 @@ void TestManager::finalize(const QString& lastWords) clog << "Logging out" << endl; c->logout().then( this, [this, lastWords] { - //clog << lastWords.toStdString() << endl; QCoreApplication::exit(!testSuite ? -3 : succeeded.empty() && failed.empty() && running.empty()