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
9
namespace
Quotient
{
10
namespace
EventContent
{
11
struct
AliasesEventContent
{
12
QString
canonicalAlias
;
13
QStringList
altAliases
;
14
};
15
}
// namespace EventContent
16
17
template
<>
18
inline
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
}
25
template
<>
26
inline
auto
toJson
(
const
EventContent
::
AliasesEventContent
& c)
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
34
class
QUOTIENT_API
RoomCanonicalAliasEvent
35
:
public
KeylessStateEventBase
<
RoomCanonicalAliasEvent
,
36
EventContent
::
AliasesEventContent
> {
37
public
:
38
QUO_EVENT
(
RoomCanonicalAliasEvent
,
"m.room.canonical_alias"
)
39
using
KeylessStateEventBase
::
KeylessStateEventBase
;
40
41
QString
alias
()
const
{
return
content
().
canonicalAlias
; }
42
QStringList
altAliases
()
const
{
return
content
().
altAliases
; }
43
};
44
}
// namespace Quotient
Quotient::RoomCanonicalAliasEvent
Definition
roomcanonicalaliasevent.h:36
QUO_EVENT
#define QUO_EVENT(CppType_, MatrixType_)
Supply event metatype information in (specific) event types.
Definition
event.h:436
Quotient::EventContent
Definition
eventcontent.h:27
Quotient
Definition
accountregistry.h:13
Quotient::fromJson
bool fromJson(const QJsonValue &jv)
Definition
converters.h:231
Quotient::toJson
auto toJson(const EventContent::AliasesEventContent &c)
Definition
roomcanonicalaliasevent.h:26
QUOTIENT_API
#define QUOTIENT_API
Definition
quotient_export.h:22
Quotient::EventContent::AliasesEventContent
Definition
roomcanonicalaliasevent.h:11
Quotient::EventContent::AliasesEventContent::canonicalAlias
QString canonicalAlias
Definition
roomcanonicalaliasevent.h:12
Quotient::EventContent::AliasesEventContent::altAliases
QStringList altAliases
Definition
roomcanonicalaliasevent.h:13
Quotient
events
roomcanonicalaliasevent.h
Generated by
1.9.8