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-09 12:33:37 +0200 |
commit | 0c8a819f8a3c31360e3f6044374aa219e93ec21e (patch) | |
tree | 2701381d733646f0e078730138341aae11ae38ef /lib | |
parent | f89ece678c47a54a28c91c2d0ced65ba3e9a6540 (diff) | |
download | libquotient-0c8a819f8a3c31360e3f6044374aa219e93ec21e.tar.gz libquotient-0c8a819f8a3c31360e3f6044374aa219e93ec21e.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 579c7920..a384783c 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -807,7 +807,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; } @@ -1464,11 +1464,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; |