aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/room_state.cpp
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
committerBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
commit363cf452bcdbaf6ff1cf94a83ca66cbb31122346 (patch)
treec64c8fda885e4e1785130e8ee3e7c47fd18cbf67 /lib/csapi/room_state.cpp
parent412e2cf19449e73aa7da729e9c5de6502687aade (diff)
parent944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff)
downloadlibquotient-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/room_state.cpp')
-rw-r--r--lib/csapi/room_state.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/csapi/room_state.cpp b/lib/csapi/room_state.cpp
index 3aa7d736..bfcd6e17 100644
--- a/lib/csapi/room_state.cpp
+++ b/lib/csapi/room_state.cpp
@@ -8,21 +8,26 @@
#include <QtCore/QStringBuilder>
-using namespace QMatrixClient;
+using namespace Quotient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
class SetRoomStateWithKeyJob::Private
{
- public:
- QString eventId;
+public:
+ QString eventId;
};
-static const auto SetRoomStateWithKeyJobName = QStringLiteral("SetRoomStateWithKeyJob");
+static const auto SetRoomStateWithKeyJobName =
+ QStringLiteral("SetRoomStateWithKeyJob");
-SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey, const QJsonObject& body)
+SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId,
+ const QString& eventType,
+ const QString& stateKey,
+ const QJsonObject& body)
: BaseJob(HttpVerb::Put, SetRoomStateWithKeyJobName,
- basePath % "/rooms/" % roomId % "/state/" % eventType % "/" % stateKey)
+ basePath % "/rooms/" % roomId % "/state/" % eventType % "/"
+ % stateKey)
, d(new Private)
{
setRequestData(Data(toJson(body)));
@@ -30,29 +35,28 @@ SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId, const QStr
SetRoomStateWithKeyJob::~SetRoomStateWithKeyJob() = default;
-const QString& SetRoomStateWithKeyJob::eventId() const
-{
- return d->eventId;
-}
+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;
+public:
+ QString eventId;
};
static const auto SetRoomStateJobName = QStringLiteral("SetRoomStateJob");
-SetRoomStateJob::SetRoomStateJob(const QString& roomId, const QString& eventType, const QJsonObject& body)
+SetRoomStateJob::SetRoomStateJob(const QString& roomId, const QString& eventType,
+ const QJsonObject& body)
: BaseJob(HttpVerb::Put, SetRoomStateJobName,
- basePath % "/rooms/" % roomId % "/state/" % eventType)
+ basePath % "/rooms/" % roomId % "/state/" % eventType)
, d(new Private)
{
setRequestData(Data(toJson(body)));
@@ -60,15 +64,12 @@ SetRoomStateJob::SetRoomStateJob(const QString& roomId, const QString& eventType
SetRoomStateJob::~SetRoomStateJob() = default;
-const QString& SetRoomStateJob::eventId() const
-{
- return d->eventId;
-}
+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;
}
-