base: Track new users we get from the room/members call.

master
Damir Jelić 2020-11-23 17:19:55 +01:00
parent c1383402ed
commit e84d3b9950
2 changed files with 15 additions and 3 deletions

View File

@ -1468,7 +1468,6 @@ impl Client {
self.send(request).await
}
#[allow(dead_code)]
async fn room_members(&self, room_id: &RoomId) -> Result<()> {
let request = get_member_events::Request::new(room_id);
let response = self.send(request).await?;

View File

@ -605,8 +605,6 @@ impl BaseClient {
let mut changes = StateChanges::default();
changes.add_room(summary);
// TODO make sure we don't overwrite memership events from a sync.
for e in &response.chunk {
if let Ok(event) = hoist_member_event(e) {
@ -623,6 +621,21 @@ impl BaseClient {
}
}
#[cfg(feature = "encryption")]
if summary.is_encrypted() {
if let Some(o) = self.olm_machine().await {
if let Some(users) = changes.joined_user_ids.get(room_id) {
o.update_tracked_users(users).await
}
if let Some(users) = changes.invited_user_ids.get(room_id) {
o.update_tracked_users(users).await
}
}
}
changes.add_room(summary);
self.store.save_changes(&changes).await;
}