aboutsummaryrefslogtreecommitdiff
path: root/connection.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-16 19:35:56 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-16 19:35:56 +0900
commit575f859bb1a16b5d680789876f156aaf1e4f6c52 (patch)
treea4384492eba3b160a78748ad7544fb8377d87417 /connection.cpp
parentc641563dda852880fb9f8189b83d02a59aabe17a (diff)
downloadlibquotient-575f859bb1a16b5d680789876f156aaf1e4f6c52.tar.gz
libquotient-575f859bb1a16b5d680789876f156aaf1e4f6c52.zip
Connection: proactively create a Room object upon joining a room
So that clients could start using this object without waiting for the next sync.
Diffstat (limited to 'connection.cpp')
-rw-r--r--connection.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/connection.cpp b/connection.cpp
index 4fb661f3..06c4dcee 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -286,7 +286,10 @@ PostReceiptJob* Connection::postReceipt(Room* room, RoomEvent* event) const
JoinRoomJob* Connection::joinRoom(const QString& roomAlias)
{
- return callApi<JoinRoomJob>(roomAlias);
+ auto job = callApi<JoinRoomJob>(roomAlias);
+ connect(job, &JoinRoomJob::success,
+ this, [=] { provideRoom(job->roomId(), JoinState::Join); });
+ return job;
}
void Connection::leaveRoom(Room* room)