aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-16 20:51:33 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-16 20:51:33 +0900
commitdf0927e8be4ea9c5cec06ed7eaee0ccf44a0942f (patch)
tree7299735ffd09c62ae6b243bad73615d1db0e9bec
parent5a34e11132b612361439c7e1243ff2f3ac959213 (diff)
downloadlibquotient-df0927e8be4ea9c5cec06ed7eaee0ccf44a0942f.tar.gz
libquotient-df0927e8be4ea9c5cec06ed7eaee0ccf44a0942f.zip
Connection::createRoom: avoid inviting yourself to the created room
-rw-r--r--lib/connection.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index d92071df..6c04cf08 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -465,9 +465,12 @@ CreateRoomJob* Connection::createRoom(RoomVisibility visibility,
const QVector<CreateRoomJob::Invite3pid>& invite3pids,
const QJsonObject& creationContent)
{
+ // FIXME: switch to using QStringList instead of const QStringList& in 0.4
+ auto filteredInvites = invites;
+ filteredInvites.removeOne(d->userId); // The creator is by definition in the room
auto job = callApi<CreateRoomJob>(
visibility == PublishRoom ? "public" : "private", alias, name,
- topic, invites, invite3pids, creationContent, initialState,
+ topic, filteredInvites, invite3pids, creationContent, initialState,
presetName, isDirect, guestsCanJoin);
connect(job, &BaseJob::success, this, [this,job] {
emit createdRoom(provideRoom(job->roomId(), JoinState::Join));