aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomkeyevent.h
blob: 3093db4142520699fc5666fd0cb97620e6b81687 (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
// SPDX-FileCopyrightText: 2019 Alexey Andreyev <aa13q@ya.ru>
// SPDX-License-Identifier: LGPL-2.1-or-later

#pragma once

#include "event.h"

namespace Quotient {
class QUOTIENT_API RoomKeyEvent : public Event
{
public:
    DEFINE_EVENT_TYPEID("m.room_key", RoomKeyEvent)

    explicit RoomKeyEvent(const QJsonObject& obj);
    explicit RoomKeyEvent(const QString& algorithm, const QString& roomId,
                          const QString& sessionId, const QString& sessionKey,
                          const QString& senderId);

    QString algorithm() const { return contentPart<QString>("algorithm"_ls); }
    QString roomId() const { return contentPart<QString>(RoomIdKeyL); }
    QString sessionId() const { return contentPart<QString>("session_id"_ls); }
    QByteArray sessionKey() const
    {
        return contentPart<QString>("session_key"_ls).toLatin1();
    }
};
REGISTER_EVENT_TYPE(RoomKeyEvent)
} // namespace Quotient