summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-07-24 19:07:45 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2023-10-25 22:24:40 -0400
commitbb971b057526c77af47181e2c956cb415c4e4bbc (patch)
tree7e282f765bc00df27a397c1404f7b67d397e8b00 /src
parentAllow setting presence state again (diff)
downloadnheko-bb971b057526c77af47181e2c956cb415c4e4bbc.tar.xz
Add report message functionality
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineModel.cpp8
-rw-r--r--src/timeline/TimelineModel.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index e8a0a507..aefdc860 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -1607,6 +1607,14 @@ TimelineModel::redactAllFromUser(const QString &userid, const QString &reason)
         std::this_thread::sleep_for(std::chrono::milliseconds(50));
     }
 }
+
+void
+TimelineModel::reportEvent(const QString &eventId, const QString &reason, const int score)
+{
+    http::client()->report_event(
+      room_id_.toStdString(), eventId.toStdString(), reason.toStdString(), score);
+}
+
 void
 TimelineModel::redactEvent(const QString &id, const QString &reason)
 {
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index 23c3c802..a3933478 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -333,6 +333,8 @@ public:
     Q_INVOKABLE void showReadReceipts(const QString &id);
     Q_INVOKABLE void redactEvent(const QString &id, const QString &reason = "");
     Q_INVOKABLE void redactAllFromUser(const QString &userid, const QString &reason = "");
+    Q_INVOKABLE void
+    reportEvent(const QString &eventId, const QString &reason = {}, const int score = -50);
     Q_INVOKABLE int idToIndex(const QString &id) const;
     Q_INVOKABLE QString indexToId(int index) const;
     Q_INVOKABLE void openMedia(const QString &eventId);