aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-15 11:44:29 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-15 11:44:29 +0900
commit87018c0a180248df4a2f61665efbfb3af84bbfea (patch)
treebb97518cf8d3ad0063d62d9e9d05803db564be30
parent6af5e93134065cd97644d2eee43b2852df549553 (diff)
downloadlibquotient-87018c0a180248df4a2f61665efbfb3af84bbfea.tar.gz
libquotient-87018c0a180248df4a2f61665efbfb3af84bbfea.zip
Room::baseStateLoaded
Mirroring Connection::loadedRoomState but for each single room (will be used as a NOTIFY signal for one-time-set events).
-rw-r--r--lib/room.cpp6
-rw-r--r--lib/room.h9
2 files changed, 15 insertions, 0 deletions
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);