1// SPDX-FileCopyrightText: 2019 Alexey Andreyev <aa13q@ya.ru>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include "event.h"
7
8namespace Quotient {
9class QUOTIENT_API RoomKeyEvent : public Event
10{
11public:
12 QUO_EVENT(RoomKeyEvent, "m.room_key")
13
14 using Event::Event;
15 explicit RoomKeyEvent(const QString& algorithm, const QString& roomId,
16 const QString& sessionId, const QString& sessionKey)
17 : Event(basicJson(matrixType: TypeId, content: {
18 { "algorithm"_ls, algorithm },
19 { "room_id"_ls, roomId },
20 { "session_id"_ls, sessionId },
21 { "session_key"_ls, sessionKey },
22 }))
23 {}
24
25 QUO_CONTENT_GETTER(QString, algorithm)
26 QUO_CONTENT_GETTER(QString, roomId)
27 QUO_CONTENT_GETTER(QString, sessionId)
28 QByteArray sessionKey() const
29 {
30 return contentPart<QString>(key: "session_key"_ls).toLatin1();
31 }
32};
33} // namespace Quotient
34