aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-13 00:02:46 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-13 10:38:28 +0200
commitd27d2ab396f92b7d5139f43afe52be6e0470eaea (patch)
tree1821adeb315fc216d76f20a69613cea9a11605bb /room.cpp
parent360fa9c8a053d8b0888c5d2a8cda6c7672cdd5a1 (diff)
downloadlibquotient-d27d2ab396f92b7d5139f43afe52be6e0470eaea.tar.gz
libquotient-d27d2ab396f92b7d5139f43afe52be6e0470eaea.zip
Support banning and unbanning
Closes #38. Also rearranged #includes
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/room.cpp b/room.cpp
index 05b16b65..79168d85 100644
--- a/room.cpp
+++ b/room.cpp
@@ -20,17 +20,8 @@
#include "jobs/generated/kicking.h"
#include "jobs/generated/inviting.h"
-
-#include <array>
-
-#include <QtCore/QHash>
-#include <QtCore/QStringBuilder> // for efficient string concats (operator%)
-#include <QtCore/QElapsedTimer>
-#include <jobs/setroomstatejob.h>
-
-#include "connection.h"
-#include "state.h"
-#include "user.h"
+#include "jobs/generated/banning.h"
+#include "jobs/setroomstatejob.h"
#include "events/roomnameevent.h"
#include "events/roomaliasesevent.h"
#include "events/roomcanonicalaliasevent.h"
@@ -42,6 +33,14 @@
#include "jobs/roommessagesjob.h"
#include "jobs/postreceiptjob.h"
#include "jobs/leaveroomjob.h"
+#include "connection.h"
+#include "user.h"
+
+#include <QtCore/QHash>
+#include <QtCore/QStringBuilder> // for efficient string concats (operator%)
+#include <QtCore/QElapsedTimer>
+
+#include <array>
using namespace QMatrixClient;
@@ -639,6 +638,16 @@ void Room::kickMember(const QString& memberId, const QString& reason) const
connection()->callApi<KickJob>(id(), memberId, reason);
}
+void Room::ban(const QString& userId, const QString& reason) const
+{
+ connection()->callApi<BanJob>(id(), userId, reason);
+}
+
+void Room::unban(const QString& userId) const
+{
+ connection()->callApi<UnbanJob>(id(), userId);
+}
+
void Room::Private::dropDuplicateEvents(RoomEvents* events) const
{
// Collect all duplicate events at the end of the container