summary refs log tree commit diff
path: root/src/timeline/Permissions.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-02 18:01:18 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-02 18:06:56 +0200
commitab0baf5d9eb3319f8d3da15bd966ab8ab2810fce (patch)
treecba4d1153ec3e8573e8a6821d3e6b07d771fdccd /src/timeline/Permissions.h
parentFix crash when you have no rooms and open the global user profile (diff)
downloadnheko-ab0baf5d9eb3319f8d3da15bd966ab8ab2810fce.tar.xz
Only show actions, when you have permissions to do them
Diffstat (limited to 'src/timeline/Permissions.h')
-rw-r--r--src/timeline/Permissions.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/timeline/Permissions.h b/src/timeline/Permissions.h
new file mode 100644
index 00000000..f7e6f389
--- /dev/null
+++ b/src/timeline/Permissions.h
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: 2021 Nheko Contributors
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
+
+#include <QObject>
+
+#include <mtx/events/power_levels.hpp>
+
+class TimelineModel;
+
+class Permissions : public QObject
+{
+        Q_OBJECT
+
+public:
+        Permissions(TimelineModel *parent);
+
+        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);
+
+        void invalidate();
+
+private:
+        TimelineModel *room;
+        mtx::events::state::PowerLevels pl;
+};