aboutsummaryrefslogtreecommitdiff
path: root/lib/events/reactionevent.h
blob: b3cb3ca73727a639b9f34fb445bcf9b605287b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-FileCopyrightText: 2019 Kitsune Ral <kitsune-ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later

#pragma once

#include "roomevent.h"
#include "eventrelation.h"

namespace Quotient {

class QUOTIENT_API ReactionEvent : public RoomEvent {
public:
    DEFINE_EVENT_TYPEID("m.reaction", ReactionEvent)

    explicit ReactionEvent(const EventRelation& value)
        : RoomEvent(typeId(), matrixTypeId(),
                    { { QStringLiteral("m.relates_to"), toJson(value) } })
    {}
    explicit ReactionEvent(const QJsonObject& obj) : RoomEvent(typeId(), obj) {}
    EventRelation relation() const
    {
        return contentPart<EventRelation>(RelatesToKey);
    }
};
REGISTER_EVENT_TYPE(ReactionEvent)

} // namespace Quotient