aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/room_state.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/room_state.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/room_state.cpp')
-rw-r--r--lib/csapi/room_state.cpp71
1 files changed, 9 insertions, 62 deletions
diff --git a/lib/csapi/room_state.cpp b/lib/csapi/room_state.cpp
index 3aa7d736..e18108ac 100644
--- a/lib/csapi/room_state.cpp
+++ b/lib/csapi/room_state.cpp
@@ -4,71 +4,18 @@
#include "room_state.h"
-#include "converters.h"
-
#include <QtCore/QStringBuilder>
-using namespace QMatrixClient;
-
-static const auto basePath = QStringLiteral("/_matrix/client/r0");
+using namespace Quotient;
-class SetRoomStateWithKeyJob::Private
-{
- public:
- QString eventId;
-};
-
-static const auto SetRoomStateWithKeyJobName = QStringLiteral("SetRoomStateWithKeyJob");
-
-SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey, const QJsonObject& body)
- : BaseJob(HttpVerb::Put, SetRoomStateWithKeyJobName,
- basePath % "/rooms/" % roomId % "/state/" % eventType % "/" % stateKey)
- , d(new Private)
+SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId,
+ const QString& eventType,
+ const QString& stateKey,
+ const QJsonObject& body)
+ : BaseJob(HttpVerb::Put, QStringLiteral("SetRoomStateWithKeyJob"),
+ QStringLiteral("/_matrix/client/r0") % "/rooms/" % roomId
+ % "/state/" % eventType % "/" % stateKey)
{
setRequestData(Data(toJson(body)));
+ addExpectedKey("event_id");
}
-
-SetRoomStateWithKeyJob::~SetRoomStateWithKeyJob() = default;
-
-const QString& SetRoomStateWithKeyJob::eventId() const
-{
- return d->eventId;
-}
-
-BaseJob::Status SetRoomStateWithKeyJob::parseJson(const QJsonDocument& data)
-{
- auto json = data.object();
- fromJson(json.value("event_id"_ls), d->eventId);
- return Success;
-}
-
-class SetRoomStateJob::Private
-{
- public:
- QString eventId;
-};
-
-static const auto SetRoomStateJobName = QStringLiteral("SetRoomStateJob");
-
-SetRoomStateJob::SetRoomStateJob(const QString& roomId, const QString& eventType, const QJsonObject& body)
- : BaseJob(HttpVerb::Put, SetRoomStateJobName,
- basePath % "/rooms/" % roomId % "/state/" % eventType)
- , d(new Private)
-{
- setRequestData(Data(toJson(body)));
-}
-
-SetRoomStateJob::~SetRoomStateJob() = default;
-
-const QString& SetRoomStateJob::eventId() const
-{
- return d->eventId;
-}
-
-BaseJob::Status SetRoomStateJob::parseJson(const QJsonDocument& data)
-{
- auto json = data.object();
- fromJson(json.value("event_id"_ls), d->eventId);
- return Success;
-}
-