libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
reactionevent.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2019 Kitsune Ral <kitsune-ral@users.sf.net>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include "roomevent.h"
8
9namespace Quotient {
10
11class QUOTIENT_API ReactionEvent
12 : public EventTemplate<
13 ReactionEvent, RoomEvent,
14 EventContent::SingleKeyValue<EventRelation, RelatesToKey>> {
15public:
16 QUO_EVENT(ReactionEvent, "m.reaction")
17 static bool isValid(const QJsonObject& fullJson)
18 {
19 return fullJson[ContentKey][RelatesToKey][RelTypeKey].toString()
20 == EventRelation::AnnotationType;
21 }
22
23 ReactionEvent(const QString& eventId, const QString& reactionKey)
24 : EventTemplate(EventRelation::annotate(eventId, reactionKey))
25 {}
26
27 QString eventId() const { return content().value.eventId; }
28 QString key() const { return content().value.key; }
29
30private:
31 explicit ReactionEvent(const QJsonObject& json) : EventTemplate(json) {}
32};
33
34} // namespace Quotient
#define QUO_EVENT(CppType_, MatrixType_)
Supply event metatype information in (specific) event types.
Definition event.h:436
#define QUOTIENT_API