aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection.cpp6
-rw-r--r--connection.h7
2 files changed, 12 insertions, 1 deletions
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<CreateRoomJob::Invite3pid>& invite3pids,
const QJsonObject creationContent)
{
- return callApi<CreateRoomJob>(
+ auto job = callApi<CreateRoomJob>(
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: