aboutsummaryrefslogtreecommitdiff
path: root/lib/events/receiptevent.h
blob: b87e00f6c2f34b36d97396964dc844a24d95495b (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
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: 2018 Kitsune Ral <Kitsune-Ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later

#pragma once

#include "event.h"

#include <QtCore/QDateTime>
#include <QtCore/QVector>

namespace Quotient {
struct UserTimestamp {
    QString userId;
    QDateTime timestamp;
};
struct ReceiptsForEvent {
    QString evtId;
    QVector<UserTimestamp> receipts;
};
using EventsWithReceipts = QVector<ReceiptsForEvent>;

template <>
QUOTIENT_API EventsWithReceipts fromJson(const QJsonObject& json);
QUOTIENT_API QJsonObject toJson(const EventsWithReceipts& ewrs);

class QUOTIENT_API ReceiptEvent
    : public EventTemplate<ReceiptEvent, Event, EventsWithReceipts> {
public:
    QUO_EVENT(ReceiptEvent, "m.receipt")
    using EventTemplate::EventTemplate;

    [[deprecated("Use content() instead")]]
    EventsWithReceipts eventsWithReceipts() const { return content(); }
};
} // namespace Quotient