libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
roomkeyevent.h
Go to the documentation of this file.
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(TypeId, {
18 { "algorithm"_L1, algorithm },
19 { "room_id"_L1, roomId },
20 { "session_id"_L1, sessionId },
21 { "session_key"_L1, 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>("session_key"_L1).toLatin1();
31 }
32};
33} // namespace Quotient
#define QUO_CONTENT_GETTER(PartType_, PartName_)
Define an inline method obtaining a content part.
Definition event.h:465
#define QUO_EVENT(CppType_, MatrixType_)
Supply event metatype information in (specific) event types.
Definition event.h:436
#define QUOTIENT_API