2021-05-02 19:01:18 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2023-01-02 06:25:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2023 Nheko Contributors
|
2021-05-02 19:01:18 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include <mtx/events/power_levels.hpp>
|
|
|
|
|
|
|
|
class TimelineModel;
|
|
|
|
|
2022-10-10 15:38:29 +03:00
|
|
|
class Permissions final : public QObject
|
2021-05-02 19:01:18 +03:00
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_OBJECT
|
2021-05-02 19:01:18 +03:00
|
|
|
|
|
|
|
public:
|
2021-09-18 01:22:33 +03:00
|
|
|
Permissions(QString roomId, QObject *parent = nullptr);
|
2021-05-02 19:01:18 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_INVOKABLE bool canInvite();
|
|
|
|
Q_INVOKABLE bool canBan();
|
|
|
|
Q_INVOKABLE bool canKick();
|
2021-05-02 19:01:18 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_INVOKABLE bool canRedact();
|
|
|
|
Q_INVOKABLE bool canChange(int eventType);
|
|
|
|
Q_INVOKABLE bool canSend(int eventType);
|
2022-05-07 03:30:16 +03:00
|
|
|
Q_INVOKABLE int defaultLevel();
|
|
|
|
Q_INVOKABLE int redactLevel();
|
|
|
|
Q_INVOKABLE int changeLevel(int eventType);
|
|
|
|
Q_INVOKABLE int sendLevel(int eventType);
|
2021-05-02 19:01:18 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_INVOKABLE bool canPingRoom();
|
2021-09-02 04:15:07 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
void invalidate();
|
2021-05-02 19:01:18 +03:00
|
|
|
|
2022-10-13 18:19:54 +03:00
|
|
|
const mtx::events::state::PowerLevels &powerlevelEvent() const { return pl; };
|
|
|
|
|
2021-05-02 19:01:18 +03:00
|
|
|
private:
|
2021-09-18 01:22:33 +03:00
|
|
|
QString roomId_;
|
|
|
|
mtx::events::state::PowerLevels pl;
|
2021-05-02 19:01:18 +03:00
|
|
|
};
|