base: Store room infos for left and invited rooms

master
Damir Jelić 2021-01-21 15:12:13 +01:00
parent 1483c22171
commit 66ecb4c1e6
2 changed files with 9 additions and 2 deletions

View File

@ -821,6 +821,7 @@ impl BaseClient {
.handle_room_account_data(&room_id, &new_info.account_data.events, &mut changes)
.await;
changes.add_room(room_info);
rooms
.leave
.insert(room_id, LeftRoom::new(timeline, state, account_data));
@ -845,6 +846,7 @@ impl BaseClient {
changes.stripped_members.insert(room_id.clone(), members);
changes.stripped_state.insert(room_id.clone(), state_events);
changes.add_stripped_room(room_info);
let room = InvitedRoom {
invite_state: state,

View File

@ -28,7 +28,7 @@ use matrix_sdk_common::{
use crate::{
deserialized_responses::{MemberEvent, StrippedMemberEvent},
rooms::{RoomInfo, RoomType, StrippedRoom},
rooms::{RoomInfo, RoomType, StrippedRoom, StrippedRoomInfo},
InvitedRoom, JoinedRoom, LeftRoom, Room, RoomState, Session,
};
@ -231,7 +231,7 @@ pub struct StateChanges {
pub stripped_state: BTreeMap<RoomId, BTreeMap<String, BTreeMap<String, AnyStrippedStateEvent>>>,
pub stripped_members: BTreeMap<RoomId, BTreeMap<UserId, StrippedMemberEvent>>,
pub invited_room_info: BTreeMap<RoomId, RoomInfo>,
pub invited_room_info: BTreeMap<RoomId, StrippedRoomInfo>,
}
impl StateChanges {
@ -251,6 +251,11 @@ impl StateChanges {
.insert(room.room_id.as_ref().to_owned(), room);
}
pub fn add_stripped_room(&mut self, room: StrippedRoomInfo) {
self.invited_room_info
.insert(room.room_id.as_ref().to_owned(), room);
}
pub fn add_account_data(&mut self, event: AnyBasicEvent) {
self.account_data
.insert(event.content().event_type().to_owned(), event);