diff --git a/src/models/accountemoticonmodel.cpp b/src/models/accountemoticonmodel.cpp index 708640265..0a595e481 100644 --- a/src/models/accountemoticonmodel.cpp +++ b/src/models/accountemoticonmodel.cpp @@ -163,7 +163,11 @@ void AccountEmoticonModel::setEmoticonImage(int index, const QUrl &source) QCoro::Task AccountEmoticonModel::doSetEmoticonImage(int index, QUrl source) { auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString()); +#if Quotient_VERSION_MINOR > 8 + co_await qCoro(job.get(), &BaseJob::finished); +#else co_await qCoro(job, &BaseJob::finished); +#endif if (job->error() != BaseJob::NoError) { co_return; } @@ -185,7 +189,11 @@ QCoro::Task AccountEmoticonModel::doSetEmoticonImage(int index, QUrl sourc QCoro::Task AccountEmoticonModel::doAddEmoticon(QUrl source, QString shortcode, QString description, QString type) { auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString()); +#if Quotient_VERSION_MINOR > 8 + co_await qCoro(job.get(), &BaseJob::finished); +#else co_await qCoro(job, &BaseJob::finished); +#endif if (job->error() != BaseJob::NoError) { co_return; } diff --git a/src/models/devicesmodel.cpp b/src/models/devicesmodel.cpp index 33c3c9112..bf71e6819 100644 --- a/src/models/devicesmodel.cpp +++ b/src/models/devicesmodel.cpp @@ -128,8 +128,12 @@ void DevicesModel::logout(const QString &deviceId, const QString &password) authData["type"_ls] = "m.login.password"_ls; QJsonObject identifier = {{"type"_ls, "m.id.user"_ls}, {"user"_ls, m_connection->user()->id()}}; authData["identifier"_ls] = identifier; - auto *innerJob = m_connection->callApi(m_devices[index].deviceId, authData); + auto innerJob = m_connection->callApi(m_devices[index].deviceId, authData); +#if Quotient_VERSION_MINOR > 8 + connect(innerJob.get(), &BaseJob::success, this, onSuccess); +#else connect(innerJob, &BaseJob::success, this, onSuccess); +#endif } else { onSuccess(); } diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index 9cd3ff8da..868cdd78d 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -1156,7 +1156,11 @@ QCoro::Task NeoChatRoom::doDeleteMessagesByUser(const QString &user, QStri } for (const auto &e : events) { auto job = connection()->callApi(id(), QString::fromLatin1(QUrl::toPercentEncoding(e)), connection()->generateTxnId(), reason); +#if Quotient_VERSION_MINOR > 8 + co_await qCoro(job.get(), &BaseJob::finished); +#else co_await qCoro(job, &BaseJob::finished); +#endif if (job->error() != BaseJob::Success) { qWarning() << "Error: \"" << job->error() << "\" while deleting messages. Aborting"; break; diff --git a/src/roommanager.cpp b/src/roommanager.cpp index 62b384d8b..a4c3cfc53 100644 --- a/src/roommanager.cpp +++ b/src/roommanager.cpp @@ -301,7 +301,11 @@ void RoomManager::visitRoom(Room *r, const QString &eventId) void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QStringList &viaServers) { auto job = account->joinRoom(roomAliasOrId, viaServers); +#if Quotient_VERSION_MINOR > 8 + connectSingleShot(job.get(), &Quotient::BaseJob::finished, this, [this, account](Quotient::BaseJob *finish) { +#else connectSingleShot(job, &Quotient::BaseJob::finished, this, [this, account](Quotient::BaseJob *finish) { +#endif if (finish->status() == Quotient::BaseJob::Success) { connectSingleShot(account, &NeoChatConnection::newRoom, this, [this](Quotient::Room *room) { resolveResource(room->id()); @@ -314,12 +318,16 @@ void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAli void RoomManager::knockRoom(NeoChatConnection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers) { - auto *const job = account->callApi(roomAliasOrId, viaServers, reason); + auto job = account->callApi(roomAliasOrId, viaServers, reason); // Upon completion, ensure a room object is created in case it hasn't come // with a sync yet. If the room object is not there, provideRoom() will // create it in Join state. finished() is used here instead of success() // to overtake clients that may add their own slots to finished(). +#if Quotient_VERSION_MINOR > 8 + connectSingleShot(job.get(), &BaseJob::finished, this, [this, job, account] { +#else connectSingleShot(job, &BaseJob::finished, this, [this, job, account] { +#endif if (job->status() == Quotient::BaseJob::Success) { connectSingleShot(account, &NeoChatConnection::newRoom, this, [this](Quotient::Room *room) { Q_EMIT currentRoom()->showMessage(NeoChatRoom::Info, i18n("You requested to join '%1'", room->name()));