// SPDX-FileCopyrightText: 2019 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #include "roomcreateevent.h" using namespace Quotient; template <> RoomType Quotient::fromJson(const QJsonValue& jv) { return enumFromJsonString(jv.toString(), RoomTypeStrings, RoomType::Undefined); } bool RoomCreateEvent::isFederated() const { return contentPart("m.federate"_ls); } QString RoomCreateEvent::version() const { return contentPart("room_version"_ls); } RoomCreateEvent::Predecessor RoomCreateEvent::predecessor() const { const auto predJson = contentPart("predecessor"_ls); return { fromJson(predJson[RoomIdKeyL]), fromJson(predJson[EventIdKeyL]) }; } bool RoomCreateEvent::isUpgrade() const { return contentJson().contains("predecessor"_ls); } RoomType RoomCreateEvent::roomType() const { return contentPart("type"_ls); }