diff options
author | Tobias Fella <fella@posteo.de> | 2021-05-19 00:35:53 +0200 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:56:11 +0100 |
commit | c408b460bea2010c6745e03c549e136d6b1d9ec6 (patch) | |
tree | f737de0ffb3f9abdd6710ca2cb03ea5044fc4248 | |
parent | e0945db3c4c539040f07ff7683efa9dc4e6b9e6a (diff) | |
download | libquotient-c408b460bea2010c6745e03c549e136d6b1d9ec6.tar.gz libquotient-c408b460bea2010c6745e03c549e136d6b1d9ec6.zip |
Start tracking user's devices when a a room starts being encrypted
-rw-r--r-- | lib/connection.cpp | 13 | ||||
-rw-r--r-- | lib/room.cpp | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 8ceb2a44..2864f3b3 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -1861,4 +1861,17 @@ void Connection::Private::loadOutdatedUserDevices() } }); } + +void Connection::newEncryptedRoom(Room *room) +{ + for(const auto &user : room->users()) { + if(!d->trackedUsers.contains(user->id())) { + d->trackedUsers += user->id(); + d->outdatedUsers += user->id(); + } + } + if(!d->outdatedUsers.isEmpty()) { + d->loadOutdatedUserDevices(); + } +} #endif diff --git a/lib/room.cpp b/lib/room.cpp index 1a7a9911..b6022f1b 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -475,6 +475,9 @@ Room::Room(Connection* connection, QString id, JoinState initialJoinState) emit baseStateLoaded(); return this == r; // loadedRoomState fires only once per room }); + connectSingleShot(this, &Room::encryption, this, [=](){ + connection->newEncryptedRoom(this); + }); qCDebug(STATE) << "New" << terse << initialJoinState << "Room:" << id; } |