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
8namespace Quotient {
9
10constexpr inline auto RelatesToKey = "m.relates_to"_L1;
11constexpr inline auto RelTypeKey = "rel_type"_L1;
12constexpr inline auto IsFallingBackKey = "is_falling_back"_L1;
13constexpr inline auto NewContentKey = "m.new_content"_L1;
14constexpr inline auto RelationsKey = "m.relations"_L1;
15
16//! \brief Data about one relation of an event to an upstream event (e.g. a reply or a reaction)
17//!
18//! This structure contains all information pertaining to a single event relation. In terms of
19//! CS API it corresponds to the contents of `m.relates_to` and `m.in_reply_to` JSON objects.
22 using reltypeid_t [[deprecated("Use typeid_t")]] = typeid_t;
23
26 QString key = {}; // Only used for m.annotation for now
27 bool isFallingBack = false;
28 // Only used for m.thread to provide the reply event fallback for non-threaded clients
29 // or to allow a reply within the thread.
31
32 static constexpr auto ReplyType = "m.in_reply_to"_L1;
33 static constexpr auto AnnotationType = "m.annotation"_L1;
34 static constexpr auto ReplacementType = "m.replace"_L1;
35 static constexpr auto ThreadType = "m.thread"_L1;
36
38 {
39 return { ReplyType, std::move(eventId) };
40 }
42 {
43 return { AnnotationType, std::move(eventId), std::move(key) };
44 }
46 {
47 return { ReplacementType, std::move(eventId) };
48 }
51 {
52 return {
54 };
55 }
56};
57
58template <>
60 static void dumpTo(QJsonObject& jo, const EventRelation& pod);
61 static void fillFrom(const QJsonObject& jo, EventRelation& pod);
62};
63
64} // namespace Quotient
constexpr auto IsFallingBackKey
constexpr auto NewContentKey
constexpr auto RelationsKey
constexpr auto RelTypeKey
constexpr auto RelatesToKey
#define QUOTIENT_API
Data about one relation of an event to an upstream event (e.g. a reply or a reaction)