libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
roomcanonicalaliasevent.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020 Ram Nad <ramnad1999@gmail.com>
2// SPDX-FileCopyrightText: 2020 Kitsune Ral <Kitsune-Ral@users.sf.net>
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#pragma once
6
7#include "stateevent.h"
8
9namespace Quotient {
10namespace EventContent {
14 };
15} // namespace EventContent
16
17template<>
18inline EventContent::AliasesEventContent fromJson(const QJsonObject& jo)
19{
20 return EventContent::AliasesEventContent {
21 fromJson<QString>(jo["alias"_L1]),
22 fromJson<QStringList>(jo["alt_aliases"_L1])
23 };
24}
25template<>
27{
28 QJsonObject jo;
29 addParam<IfNotEmpty>(jo, "alias"_L1, c.canonicalAlias);
30 addParam<IfNotEmpty>(jo, "alt_aliases"_L1, c.altAliases);
31 return jo;
32}
33
37public:
38 QUO_EVENT(RoomCanonicalAliasEvent, "m.room.canonical_alias")
40
41 QString alias() const { return content().canonicalAlias; }
43};
44} // namespace Quotient
#define QUO_EVENT(CppType_, MatrixType_)
Supply event metatype information in (specific) event types.
Definition event.h:436
bool fromJson(const QJsonValue &jv)
Definition converters.h:231
auto toJson(const EventContent::AliasesEventContent &c)
#define QUOTIENT_API