libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
eventrelation.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2022 Kitsune Ral <kitsune-ral@users.sf.net>
2
// SPDX-License-Identifier: LGPL-2.1-or-later
3
4
#
pragma
once
5
6
#
include
<
Quotient
/
converters
.
h
>
7
8
namespace
Quotient
{
9
10
constexpr
inline
auto
RelatesToKey
=
"m.relates_to"_L1
;
11
constexpr
inline
auto
RelTypeKey
=
"rel_type"_L1
;
12
constexpr
inline
auto
IsFallingBackKey
=
"is_falling_back"_L1
;
13
14
struct
QUOTIENT_API
EventRelation
{
15
using
reltypeid_t
=
QLatin1String
;
16
17
QString
type
;
18
QString
eventId
;
19
QString
key
= {};
// Only used for m.annotation for now
20
bool
isFallingBack
=
false
;
21
// Only used for m.thread to provide the reply event fallback for non-threaded clients
22
// or to allow a reply within the thread.
23
QString
inThreadReplyEventId
= {};
24
25
static
constexpr
auto
ReplyType
=
"m.in_reply_to"_L1
;
26
static
constexpr
auto
AnnotationType
=
"m.annotation"_L1
;
27
static
constexpr
auto
ReplacementType
=
"m.replace"_L1
;
28
static
constexpr
auto
ThreadType
=
"m.thread"_L1
;
29
30
static
EventRelation
replyTo
(
QString
eventId
)
31
{
32
return
{
ReplyType
,
std
::
move
(
eventId
) };
33
}
34
static
EventRelation
annotate
(
QString
eventId
,
QString
key
)
35
{
36
return
{
AnnotationType
,
std
::
move
(
eventId
),
std
::
move
(
key
) };
37
}
38
static
EventRelation
replace
(
QString
eventId
)
39
{
40
return
{
ReplacementType
,
std
::
move
(
eventId
) };
41
}
42
static
EventRelation
replyInThread
(
QString
threadRootId
,
bool
isFallingBack
,
43
QString
inThreadReplyEventId
)
44
{
45
return
{
46
ThreadType
,
std
::
move
(
threadRootId
), {},
isFallingBack
,
std
::
move
(
inThreadReplyEventId
)
47
};
48
}
49
};
50
51
template
<>
52
struct
QUOTIENT_API
JsonObjectConverter
<
EventRelation
> {
53
static
void
dumpTo
(
QJsonObject
&
jo
,
const
EventRelation
&
pod
);
54
static
void
fillFrom
(
const
QJsonObject
&
jo
,
EventRelation
&
pod
);
55
};
56
57
}
// namespace Quotient
Quotient
Definition
accountregistry.h:13
Quotient::IsFallingBackKey
constexpr auto IsFallingBackKey
Definition
eventrelation.h:12
Quotient::RelTypeKey
constexpr auto RelTypeKey
Definition
eventrelation.h:11
Quotient::RelatesToKey
constexpr auto RelatesToKey
Definition
eventrelation.h:10
QUOTIENT_API
#define QUOTIENT_API
Definition
quotient_export.h:22
Quotient::EventRelation
Definition
eventrelation.h:14
Quotient
events
eventrelation.h
Generated by
1.9.8