From 7f7ca55599887af0ad8d2eb9efbf432fc140ffca Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 31 Jan 2018 10:30:12 +0900 Subject: Connection::createdRoom() signal --- connection.cpp | 6 +++++- connection.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/connection.cpp b/connection.cpp index e06baef7..4b7d4abb 100644 --- a/connection.cpp +++ b/connection.cpp @@ -394,10 +394,14 @@ CreateRoomJob* Connection::createRoom(RoomVisibility visibility, const QVector& invite3pids, const QJsonObject creationContent) { - return callApi( + auto job = callApi( visibility == PublishRoom ? "public" : "private", alias, name, topic, invites, invite3pids, creationContent, initialState, presetName, isDirect, guestsCanJoin); + connect(job, &BaseJob::success, this, [this,job] { + emit createdRoom(provideRoom(job->roomId(), JoinState::Join)); + }); + return job; } CreateRoomJob* Connection::createDirectChat(const QString& userId, diff --git a/connection.h b/connection.h index 2f7c38b3..c0f013ad 100644 --- a/connection.h +++ b/connection.h @@ -323,6 +323,13 @@ namespace QMatrixClient /** The room object is about to be deleted */ void aboutToDeleteRoom(Room* room); + /** The room has just been created by createRoom or createDirectChat + * This signal is not emitted in usual room state transitions, + * only as an outcome of room creation operations invoked by + * the client. + */ + void createdRoom(Room* room); + void cacheStateChanged(); protected: -- cgit v1.2.3