diff options
author | Black Hat <bhat@encom.eu.org> | 2019-09-26 22:22:36 -0700 |
---|---|---|
committer | Black Hat <bhat@encom.eu.org> | 2019-09-26 22:22:36 -0700 |
commit | 363cf452bcdbaf6ff1cf94a83ca66cbb31122346 (patch) | |
tree | c64c8fda885e4e1785130e8ee3e7c47fd18cbf67 /lib/csapi/event_context.cpp | |
parent | 412e2cf19449e73aa7da729e9c5de6502687aade (diff) | |
parent | 944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff) | |
download | libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.tar.gz libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.zip |
Merge branch 'master' of https://github.com/quotient-im/libQuotient into
bhat-libqtolm-update
Diffstat (limited to 'lib/csapi/event_context.cpp')
-rw-r--r-- | lib/csapi/event_context.cpp | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp index bb1f5301..d233eedb 100644 --- a/lib/csapi/event_context.cpp +++ b/lib/csapi/event_context.cpp @@ -8,19 +8,19 @@ #include <QtCore/QStringBuilder> -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); class GetEventContextJob::Private { - public: - QString begin; - QString end; - RoomEvents eventsBefore; - RoomEventPtr event; - RoomEvents eventsAfter; - StateEvents state; +public: + QString begin; + QString end; + RoomEvents eventsBefore; + RoomEventPtr event; + RoomEvents eventsAfter; + StateEvents state; }; BaseJob::Query queryToGetEventContext(Omittable<int> limit) @@ -30,54 +30,46 @@ BaseJob::Query queryToGetEventContext(Omittable<int> limit) return _q; } -QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, Omittable<int> limit) +QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& eventId, + Omittable<int> limit) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)); + basePath % "/rooms/" % roomId % "/context/" + % eventId, + queryToGetEventContext(limit)); } static const auto GetEventContextJobName = QStringLiteral("GetEventContextJob"); -GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, Omittable<int> limit) +GetEventContextJob::GetEventContextJob(const QString& roomId, + const QString& eventId, + Omittable<int> limit) : BaseJob(HttpVerb::Get, GetEventContextJobName, - basePath % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)) + basePath % "/rooms/" % roomId % "/context/" % eventId, + queryToGetEventContext(limit)) , d(new Private) -{ -} +{} GetEventContextJob::~GetEventContextJob() = default; -const QString& GetEventContextJob::begin() const -{ - return d->begin; -} +const QString& GetEventContextJob::begin() const { return d->begin; } -const QString& GetEventContextJob::end() const -{ - return d->end; -} +const QString& GetEventContextJob::end() const { return d->end; } RoomEvents&& GetEventContextJob::eventsBefore() { return std::move(d->eventsBefore); } -RoomEventPtr&& GetEventContextJob::event() -{ - return std::move(d->event); -} +RoomEventPtr&& GetEventContextJob::event() { return std::move(d->event); } RoomEvents&& GetEventContextJob::eventsAfter() { return std::move(d->eventsAfter); } -StateEvents&& GetEventContextJob::state() -{ - return std::move(d->state); -} +StateEvents&& GetEventContextJob::state() { return std::move(d->state); } BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data) { @@ -88,6 +80,6 @@ BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data) fromJson(json.value("event"_ls), d->event); fromJson(json.value("events_after"_ls), d->eventsAfter); fromJson(json.value("state"_ls), d->state); + return Success; } - |