aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/peeking_events.cpp
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
committerAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
commit09eb39236666e81d5da014acea011dcd74d0999b (patch)
tree52876d96be71be1a39d5d935c1295a51995e8949 /lib/csapi/peeking_events.cpp
parentf1788ee27f33e9339334e0d79bde9a27d9ce2e44 (diff)
parenta4e78956f105875625b572d8b98459ffa86fafe5 (diff)
downloadlibquotient-09eb39236666e81d5da014acea011dcd74d0999b.tar.gz
libquotient-09eb39236666e81d5da014acea011dcd74d0999b.zip
Update upstream source from tag 'upstream/0.6.4'
Update to upstream version '0.6.4' with Debian dir aa8705fd74743e79c043bc9e3e425d5064404cfe
Diffstat (limited to 'lib/csapi/peeking_events.cpp')
-rw-r--r--lib/csapi/peeking_events.cpp67
1 files changed, 14 insertions, 53 deletions
diff --git a/lib/csapi/peeking_events.cpp b/lib/csapi/peeking_events.cpp
index 3208d48d..70a5b6f3 100644
--- a/lib/csapi/peeking_events.cpp
+++ b/lib/csapi/peeking_events.cpp
@@ -4,23 +4,12 @@
#include "peeking_events.h"
-#include "converters.h"
-
#include <QtCore/QStringBuilder>
-using namespace QMatrixClient;
-
-static const auto basePath = QStringLiteral("/_matrix/client/r0");
-
-class PeekEventsJob::Private
-{
- public:
- QString begin;
- QString end;
- RoomEvents chunk;
-};
+using namespace Quotient;
-BaseJob::Query queryToPeekEvents(const QString& from, Omittable<int> timeout, const QString& roomId)
+auto queryToPeekEvents(const QString& from, Omittable<int> timeout,
+ const QString& roomId)
{
BaseJob::Query _q;
addParam<IfNotEmpty>(_q, QStringLiteral("from"), from);
@@ -29,46 +18,18 @@ BaseJob::Query queryToPeekEvents(const QString& from, Omittable<int> timeout, co
return _q;
}
-QUrl PeekEventsJob::makeRequestUrl(QUrl baseUrl, const QString& from, Omittable<int> timeout, const QString& roomId)
+QUrl PeekEventsJob::makeRequestUrl(QUrl baseUrl, const QString& from,
+ Omittable<int> timeout, const QString& roomId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/events",
- queryToPeekEvents(from, timeout, roomId));
-}
-
-static const auto PeekEventsJobName = QStringLiteral("PeekEventsJob");
-
-PeekEventsJob::PeekEventsJob(const QString& from, Omittable<int> timeout, const QString& roomId)
- : BaseJob(HttpVerb::Get, PeekEventsJobName,
- basePath % "/events",
- queryToPeekEvents(from, timeout, roomId))
- , d(new Private)
-{
-}
-
-PeekEventsJob::~PeekEventsJob() = default;
-
-const QString& PeekEventsJob::begin() const
-{
- return d->begin;
-}
-
-const QString& PeekEventsJob::end() const
-{
- return d->end;
-}
-
-RoomEvents&& PeekEventsJob::chunk()
-{
- return std::move(d->chunk);
-}
-
-BaseJob::Status PeekEventsJob::parseJson(const QJsonDocument& data)
-{
- auto json = data.object();
- fromJson(json.value("start"_ls), d->begin);
- fromJson(json.value("end"_ls), d->end);
- fromJson(json.value("chunk"_ls), d->chunk);
- return Success;
+ QStringLiteral("/_matrix/client/r0")
+ % "/events",
+ queryToPeekEvents(from, timeout, roomId));
}
+PeekEventsJob::PeekEventsJob(const QString& from, Omittable<int> timeout,
+ const QString& roomId)
+ : BaseJob(HttpVerb::Get, QStringLiteral("PeekEventsJob"),
+ QStringLiteral("/_matrix/client/r0") % "/events",
+ queryToPeekEvents(from, timeout, roomId))
+{}