diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-05-08 10:07:54 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-05-08 10:07:54 +0200 |
commit | 0ce00a737cd8cd87d12cff716071808b90a4919e (patch) | |
tree | 314be6436985a04ebfa6157c3361d99838291be7 /lib | |
parent | 52092d332dbc8b300a70cb47cd3b4edd98a37149 (diff) | |
download | libquotient-0ce00a737cd8cd87d12cff716071808b90a4919e.tar.gz libquotient-0ce00a737cd8cd87d12cff716071808b90a4919e.zip |
Fix joinedRoom signal not being emitted in some cases
An alternative implementation of #463 (and thanks to Carl for spotting
the original problem).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connection.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index c4587f30..1ac439a3 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -811,7 +811,7 @@ JoinRoomJob* Connection::joinRoom(const QString& roomAlias, // that may add their own slots to finished(). connect(job, &BaseJob::finished, this, [this, job] { if (job->status().good()) - provideRoom(job->roomId()); + provideRoom(job->roomId(), JoinState::Join); }); return job; } @@ -1474,11 +1474,13 @@ Room* Connection::provideRoom(const QString& id, Omittable<JoinState> joinState) room = d->roomMap.value({ id, true }, nullptr); if (room) return room; - // No Invite either, setup a new room object below + // No Invite either, setup a new room object in Join state + joinState = JoinState::Join; } if (!room) { - room = roomFactory()(this, id, joinState.value_or(JoinState::Join)); + Q_ASSERT(joinState.has_value()); + room = roomFactory()(this, id, *joinState); if (!room) { qCCritical(MAIN) << "Failed to create a room" << id; return nullptr; |