From d9ff200ff62fb7f5b6b51082dc3979d5454a1bec Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 25 Aug 2018 22:40:15 +0900 Subject: Update to the recent CS API (watch out for breakage) Breaking changes: * guest_can_join is no more a thing - neither in Connection::createRoom, nor even in CreateRoomJob (it turned out that Synapse didn't really process this flag); * LoginJob has changed its list of arguments. If you use Connection to do logins (and you really should), you shouldn't be affected. * GetPublicRoomsJob now returns PublicRoomsResponse instead of providing all the response parts within the job Watch other changes in the diff. --- lib/csapi/create_room.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/csapi/create_room.cpp') diff --git a/lib/csapi/create_room.cpp b/lib/csapi/create_room.cpp index 534f8fdd..068b567f 100644 --- a/lib/csapi/create_room.cpp +++ b/lib/csapi/create_room.cpp @@ -43,7 +43,7 @@ class CreateRoomJob::Private static const auto CreateRoomJobName = QStringLiteral("CreateRoomJob"); -CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QStringList& invite, const QVector& invite3pid, const QJsonObject& creationContent, const QVector& initialState, const QString& preset, bool isDirect, bool guestCanJoin) +CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QStringList& invite, const QVector& invite3pid, const QString& roomVersion, const QJsonObject& creationContent, const QVector& initialState, const QString& preset, bool isDirect, const QJsonObject& powerLevelContentOverride) : BaseJob(HttpVerb::Post, CreateRoomJobName, basePath % "/createRoom") , d(new Private) @@ -55,11 +55,12 @@ CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAlias addParam(_data, QStringLiteral("topic"), topic); addParam(_data, QStringLiteral("invite"), invite); addParam(_data, QStringLiteral("invite_3pid"), invite3pid); + addParam(_data, QStringLiteral("room_version"), roomVersion); addParam(_data, QStringLiteral("creation_content"), creationContent); addParam(_data, QStringLiteral("initial_state"), initialState); addParam(_data, QStringLiteral("preset"), preset); addParam(_data, QStringLiteral("is_direct"), isDirect); - addParam(_data, QStringLiteral("guest_can_join"), guestCanJoin); + addParam(_data, QStringLiteral("power_level_content_override"), powerLevelContentOverride); setRequestData(_data); } @@ -73,6 +74,9 @@ const QString& CreateRoomJob::roomId() const BaseJob::Status CreateRoomJob::parseJson(const QJsonDocument& data) { auto json = data.object(); + if (!json.contains("room_id"_ls)) + return { JsonParseError, + "The key 'room_id' not found in the response" }; d->roomId = fromJson(json.value("room_id"_ls)); return Success; } -- cgit v1.2.3