diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index d3489285..28cd32eb 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -58,7 +58,7 @@ use crate::{ AccountData, Ephemeral, JoinedRoom, LeftRoom, Presence, Rooms, State, SyncResponse, Timeline, }, - rooms::{InnerSummary, Room, RoomType}, + rooms::{RoomInfo, Room, RoomType}, session::Session, store::{StateChanges, Store}, }; @@ -460,7 +460,7 @@ impl BaseClient { &self, room_id: &RoomId, ruma_timeline: &api::sync::sync_events::Timeline, - summary: &mut InnerSummary, + summary: &mut RoomInfo, mut changes: &mut StateChanges, ) -> Timeline { let mut timeline = Timeline::new(ruma_timeline.limited, ruma_timeline.prev_batch.clone()); @@ -509,7 +509,7 @@ impl BaseClient { &self, room_id: &RoomId, events: &[Raw], - summary: &mut InnerSummary, + summary: &mut RoomInfo, mut changes: &mut StateChanges, ) -> State { let mut state = State::default(); diff --git a/matrix_sdk_base/src/lib.rs b/matrix_sdk_base/src/lib.rs index c86a79ba..d68e54d7 100644 --- a/matrix_sdk_base/src/lib.rs +++ b/matrix_sdk_base/src/lib.rs @@ -49,7 +49,7 @@ mod rooms; mod session; mod store; -pub use rooms::{InnerSummary, Room, RoomMember}; +pub use rooms::{RoomInfo, Room, RoomMember}; pub use store::Store; pub use client::{BaseClient, BaseClientConfig, RoomState, RoomStateType}; diff --git a/matrix_sdk_base/src/rooms/joined.rs b/matrix_sdk_base/src/rooms/joined.rs index 9cd0cb41..76da3ce1 100644 --- a/matrix_sdk_base/src/rooms/joined.rs +++ b/matrix_sdk_base/src/rooms/joined.rs @@ -28,8 +28,6 @@ use matrix_sdk_common::{ }; use serde::{Deserialize, Serialize}; -use tracing::info; - use crate::{responses::UnreadNotificationsCount, store::Store}; use super::RoomMember; @@ -38,12 +36,12 @@ use super::RoomMember; pub struct Room { room_id: Arc, own_user_id: Arc, - inner: Arc>, + inner: Arc>, store: Store, } #[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct SomeSummary { +pub struct RoomSummary { heroes: Vec, joined_member_count: u64, invited_member_count: u64, @@ -66,7 +64,7 @@ impl Room { own_user_id: Arc::new(own_user_id.clone()), room_id: room_id.clone(), store, - inner: Arc::new(SyncMutex::new(InnerSummary { + inner: Arc::new(SyncMutex::new(RoomInfo { room_id, room_type, encryption: None, @@ -211,7 +209,7 @@ impl Room { &self.own_user_id } - pub(crate) fn clone_summary(&self) -> InnerSummary { + pub(crate) fn clone_summary(&self) -> RoomInfo { (*self.inner.lock().unwrap()).clone() } @@ -223,7 +221,7 @@ impl Room { self.inner.lock().unwrap().encryption.is_some() } - pub fn update_summary(&self, summary: InnerSummary) { + pub fn update_summary(&self, summary: RoomInfo) { let mut inner = self.inner.lock().unwrap(); *inner = summary; } @@ -268,7 +266,7 @@ impl Room { } #[derive(Clone, Debug, Serialize, Deserialize)] -pub struct InnerSummary { +pub struct RoomInfo { pub room_id: Arc, pub room_type: RoomType, @@ -278,14 +276,14 @@ pub struct InnerSummary { pub topic: Option, pub notification_counts: UnreadNotificationsCount, - pub summary: SomeSummary, + pub summary: RoomSummary, pub members_synced: bool, pub encryption: Option, pub last_prev_batch: Option, } -impl InnerSummary { +impl RoomInfo { pub fn mark_as_joined(&mut self) { self.room_type = RoomType::Joined; } @@ -314,7 +312,6 @@ impl InnerSummary { pub fn handle_state_event(&mut self, event: &AnySyncStateEvent) -> bool { match event { AnySyncStateEvent::RoomEncryption(encryption) => { - info!("MARKING ROOM {} AS ENCRYPTED", self.room_id); self.encryption = Some(encryption.content.clone()); true } @@ -345,8 +342,6 @@ impl InnerSummary { pub(crate) fn update(&mut self, summary: &RumaSummary) -> bool { let mut changed = false; - info!("UPDAGING SUMMARY FOR {} WITH {:#?}", self.room_id, summary); - if !summary.is_empty() { if !summary.heroes.is_empty() { self.summary.heroes = summary.heroes.clone(); diff --git a/matrix_sdk_base/src/rooms/mod.rs b/matrix_sdk_base/src/rooms/mod.rs index e0709ca2..70ef27a5 100644 --- a/matrix_sdk_base/src/rooms/mod.rs +++ b/matrix_sdk_base/src/rooms/mod.rs @@ -1,5 +1,5 @@ mod joined; mod members; -pub use joined::{InnerSummary, Room, RoomType}; +pub use joined::{RoomInfo, Room, RoomType}; pub use members::RoomMember; diff --git a/matrix_sdk_base/src/store.rs b/matrix_sdk_base/src/store.rs index 7c38f9e8..0e915197 100644 --- a/matrix_sdk_base/src/store.rs +++ b/matrix_sdk_base/src/store.rs @@ -12,7 +12,7 @@ use matrix_sdk_common::{ use sled::{transaction::TransactionResult, Config, Db, Transactional, Tree}; use tracing::info; -use crate::{rooms::InnerSummary, Session}; +use crate::{rooms::RoomInfo, Session}; #[derive(Debug, Clone)] pub struct Store { @@ -35,14 +35,14 @@ pub struct StateChanges { pub state: BTreeMap>, pub account_data: BTreeMap, pub room_account_data: BTreeMap>, - pub room_summaries: BTreeMap, + pub room_summaries: BTreeMap, // display_names: BTreeMap>>, pub joined_user_ids: BTreeMap>, pub invited_user_ids: BTreeMap>, pub removed_user_ids: BTreeMap, pub presence: BTreeMap, pub invitest_state: BTreeMap>, - pub invited_room_info: BTreeMap, + pub invited_room_info: BTreeMap, } impl StateChanges { @@ -82,7 +82,7 @@ impl StateChanges { .insert(user_id, event); } - pub fn add_room(&mut self, room: InnerSummary) { + pub fn add_room(&mut self, room: RoomInfo) { self.room_summaries .insert(room.room_id.as_ref().to_owned(), room); }