From 87018c0a180248df4a2f61665efbfb3af84bbfea Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 15 Feb 2019 11:44:29 +0900 Subject: Room::baseStateLoaded Mirroring Connection::loadedRoomState but for each single room (will be used as a NOTIFY signal for one-time-set events). --- lib/room.cpp | 6 ++++++ lib/room.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/room.cpp b/lib/room.cpp index d806183f..663f6037 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -296,6 +296,12 @@ Room::Room(Connection* connection, QString id, JoinState initialJoinState) // https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl-%E2%80%94-reloaded/ d->q = this; d->displayname = d->calculateDisplayname(); // Set initial "Empty room" name + connectUntil(connection, &Connection::loadedRoomState, this, + [this] (Room* r) { + if (this == r) + emit baseStateLoaded(); + return this == r; // loadedRoomState fires only once per room + }); qCDebug(MAIN) << "New" << toCString(initialJoinState) << "Room:" << id; } diff --git a/lib/room.h b/lib/room.h index 029f87b7..7e30a671 100644 --- a/lib/room.h +++ b/lib/room.h @@ -416,6 +416,15 @@ namespace QMatrixClient void markAllMessagesAsRead(); signals: + /// Initial set of state events has been loaded + /** + * The initial set is what comes from the initial sync for the room. + * This includes all basic things like RoomCreateEvent, + * RoomNameEvent, a (lazy-loaded, not full) set of RoomMemberEvents + * etc. This is a per-room reflection of Connection::loadedRoomState + * \sa Connection::loadedRoomState + */ + void baseStateLoaded(); void eventsHistoryJobChanged(); void aboutToAddHistoricalMessages(RoomEventsRange events); void aboutToAddNewMessages(RoomEventsRange events); -- cgit v1.2.3