// SPDX-FileCopyrightText: 2020 Ram Nad // SPDX-FileCopyrightText: 2020 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once #include "stateevent.h" namespace Quotient { namespace EventContent { struct AliasesEventContent { QString canonicalAlias; QStringList altAliases; }; } // namespace EventContent template<> inline EventContent::AliasesEventContent fromJson(const QJsonObject& jo) { return EventContent::AliasesEventContent { fromJson(jo["alias"_ls]), fromJson(jo["alt_aliases"_ls]) }; } template<> inline auto toJson(const EventContent::AliasesEventContent& c) { QJsonObject jo; addParam(jo, QStringLiteral("alias"), c.canonicalAlias); addParam(jo, QStringLiteral("alt_aliases"), c.altAliases); return jo; } class QUOTIENT_API RoomCanonicalAliasEvent : public KeylessStateEventBase { public: QUO_EVENT(RoomCanonicalAliasEvent, "m.room.canonical_alias") using KeylessStateEventBase::KeylessStateEventBase; QString alias() const { return content().canonicalAlias; } QStringList altAliases() const { return content().altAliases; } }; } // namespace Quotient