summary refs log tree commit diff
path: root/src/timeline/Permissions.h
blob: 055135244b7f49a5059b888200c85010e28a1c36 (plain) (blame)
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
36
37
38
39
40
41
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QObject>

#include <mtx/events/power_levels.hpp>

class TimelineModel;

class Permissions final : public QObject
{
    Q_OBJECT

public:
    Permissions(QString roomId, QObject *parent = nullptr);

    Q_INVOKABLE bool canInvite();
    Q_INVOKABLE bool canBan();
    Q_INVOKABLE bool canKick();

    Q_INVOKABLE bool canRedact();
    Q_INVOKABLE bool canChange(int eventType);
    Q_INVOKABLE bool canSend(int eventType);
    Q_INVOKABLE int defaultLevel();
    Q_INVOKABLE int redactLevel();
    Q_INVOKABLE int changeLevel(int eventType);
    Q_INVOKABLE int sendLevel(int eventType);

    Q_INVOKABLE bool canPingRoom();

    void invalidate();

    const mtx::events::state::PowerLevels &powerlevelEvent() const { return pl; };

private:
    QString roomId_;
    mtx::events::state::PowerLevels pl;
};