aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 21:38:41 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 21:38:41 +0900
commite0498178cf727732b730b92ec74b5355925b7006 (patch)
tree91d9998bb4bf6f49474450b56be15eb10c53c62f /lib/connection.cpp
parent1eb85b1b1465463830371bcd951374b7527e5bc5 (diff)
downloadlibquotient-e0498178cf727732b730b92ec74b5355925b7006.tar.gz
libquotient-e0498178cf727732b730b92ec74b5355925b7006.zip
Connection::loadedRoomState() signal
Closes #211.
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 572ac76b..dae7b663 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -82,6 +82,7 @@ class Connection::Private
// Leave state of the same room.
QHash<QPair<QString, bool>, Room*> roomMap;
QVector<QString> roomIdsToForget;
+ QVector<Room*> firstTimeRooms;
QMap<QString, User*> userMap;
DirectChatsMap directChats;
QHash<QString, AccountDataMap> accountData;
@@ -308,7 +309,11 @@ void Connection::onSyncSuccess(SyncData &&data) {
<< "state - suspiciously fast turnaround";
}
if ( auto* r = provideRoom(roomData.roomId, roomData.joinState) )
+ {
r->updateData(std::move(roomData));
+ if (d->firstTimeRooms.removeOne(r))
+ emit loadedRoomState(r);
+ }
QCoreApplication::processEvents();
}
for (auto&& accountEvent: data.takeAccountData())
@@ -804,6 +809,7 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
return nullptr;
}
d->roomMap.insert(roomKey, room);
+ d->firstTimeRooms.push_back(room);
emit newRoom(room);
}
if (joinState == JoinState::Invite)