aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 07c24c92..c09de979 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -609,8 +609,17 @@ CreateRoomJob* Connection::createRoom(RoomVisibility visibility,
: QStringLiteral("private"),
alias, name, topic, invites, invite3pids, roomVersion,
creationContent, initialState, presetName, isDirect);
- connect(job, &BaseJob::success, this, [this,job] {
- emit createdRoom(provideRoom(job->roomId(), JoinState::Join));
+ connect(job, &BaseJob::success, this, [this,job,invites,isDirect] {
+ auto* room = provideRoom(job->roomId(), JoinState::Join);
+ if (!room)
+ {
+ Q_ASSERT_X(room, "Connection::createRoom", "Failed to create a room");
+ return;
+ }
+ emit createdRoom(room);
+ if (isDirect)
+ for (const auto& i: invites)
+ addToDirectChats(room, user(i));
});
return job;
}
@@ -1161,6 +1170,9 @@ Room* Connection::provideRoom(const QString& id, Omittable<JoinState> joinState)
emit leftRoom(room, prevInvite);
if (prevInvite)
{
+ const auto dcUsers = prevInvite->directChatUsers();
+ for (auto* u: dcUsers)
+ addToDirectChats(room, u);
qCDebug(MAIN) << "Deleting Invite state for room" << prevInvite->id();
emit prevInvite->beforeDestruction(prevInvite);
prevInvite->deleteLater();