diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index cef10e24..9224e36c 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -46,7 +46,7 @@ use crate::identifiers::DeviceId; use crate::api; use crate::VERSION; use crate::{Error, EventEmitter, Result}; -use matrix_sdk_base::Client as BaseClient; +use matrix_sdk_base::BaseClient; use matrix_sdk_base::Room; use matrix_sdk_base::Session; use matrix_sdk_base::StateStore; diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index 842eabad..f8a4c75a 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -88,7 +88,7 @@ pub enum RoomState { /// This Client is a state machine that receives responses and events and /// accordingly updates it's state. #[derive(Clone)] -pub struct Client { +pub struct BaseClient { /// The current client session containing our user id, device id and access /// token. session: Arc>>, @@ -119,7 +119,7 @@ pub struct Client { olm: Arc>>, } -impl fmt::Debug for Client { +impl fmt::Debug for BaseClient { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Client") .field("session", &self.session) @@ -132,7 +132,7 @@ impl fmt::Debug for Client { } } -impl Client { +impl BaseClient { /// Create a new client. /// /// # Arguments @@ -140,7 +140,7 @@ impl Client { /// * `session` - An optional session if the user already has one from a /// previous login call. pub fn new(session: Option) -> Result { - Client::new_helper(session, None) + BaseClient::new_helper(session, None) } /// Create a new client. @@ -156,7 +156,7 @@ impl Client { session: Option, store: Box, ) -> Result { - Client::new_helper(session, Some(store)) + BaseClient::new_helper(session, Some(store)) } fn new_helper(session: Option, store: Option>) -> Result { @@ -166,7 +166,7 @@ impl Client { None => None, }; - Ok(Client { + Ok(BaseClient { session: Arc::new(RwLock::new(session)), sync_token: Arc::new(RwLock::new(None)), joined_rooms: Arc::new(RwLock::new(HashMap::new())), diff --git a/matrix_sdk_base/src/event_emitter/mod.rs b/matrix_sdk_base/src/event_emitter/mod.rs index e3c49485..af7d179f 100644 --- a/matrix_sdk_base/src/event_emitter/mod.rs +++ b/matrix_sdk_base/src/event_emitter/mod.rs @@ -285,7 +285,7 @@ mod test { use crate::api::r0::sync::sync_events::Response as SyncResponse; use crate::identifiers::UserId; - use crate::{Client, Session}; + use crate::{BaseClient, Session}; use http::Response; use std::convert::TryFrom; @@ -300,13 +300,13 @@ mod test { SyncResponse::try_from(response).unwrap() } - fn get_client() -> Client { + fn get_client() -> BaseClient { let session = Session { access_token: "1234".to_owned(), user_id: UserId::try_from("@example:example.com").unwrap(), device_id: "DEVICEID".to_owned(), }; - Client::new(Some(session)).unwrap() + BaseClient::new(Some(session)).unwrap() } #[tokio::test] diff --git a/matrix_sdk_base/src/lib.rs b/matrix_sdk_base/src/lib.rs index 8ba5eb0c..c1865a3c 100644 --- a/matrix_sdk_base/src/lib.rs +++ b/matrix_sdk_base/src/lib.rs @@ -36,7 +36,7 @@ mod models; mod session; mod state; -pub use client::{Client, RoomState, RoomStateType}; +pub use client::{BaseClient, RoomState, RoomStateType}; pub use event_emitter::EventEmitter; #[cfg(feature = "encryption")] pub use matrix_sdk_crypto::{Device, TrustState}; diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index 9ee27183..f2de36b0 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -524,7 +524,7 @@ mod test { use crate::api::r0::sync::sync_events::Response as SyncResponse; use crate::events::room::member::MembershipState; use crate::identifiers::UserId; - use crate::{Client, Session}; + use crate::{BaseClient, Session}; use matrix_sdk_test::EventBuilder; use http::Response; @@ -542,13 +542,13 @@ mod test { SyncResponse::try_from(response).unwrap() } - fn get_client() -> Client { + fn get_client() -> BaseClient { let session = Session { access_token: "1234".to_owned(), user_id: UserId::try_from("@example:localhost").unwrap(), device_id: "DEVICEID".to_owned(), }; - Client::new(Some(session)).unwrap() + BaseClient::new(Some(session)).unwrap() } fn get_room_id() -> RoomId { @@ -677,7 +677,7 @@ mod test { user_id: UserId::try_from("@example:localhost").unwrap(), device_id: "DEVICEID".to_owned(), }; - let client = Client::new(Some(session)).unwrap(); + let client = BaseClient::new(Some(session)).unwrap(); client.receive_sync_response(&mut response).await.unwrap(); let mut room_names = vec![]; diff --git a/matrix_sdk_base/src/models/room_member.rs b/matrix_sdk_base/src/models/room_member.rs index e559b921..afedb5a2 100644 --- a/matrix_sdk_base/src/models/room_member.rs +++ b/matrix_sdk_base/src/models/room_member.rs @@ -204,19 +204,19 @@ mod test { use crate::events::collections::all::RoomEvent; use crate::events::room::member::MembershipState; use crate::identifiers::{RoomId, UserId}; - use crate::{Client, Session}; + use crate::{BaseClient, Session}; use crate::js_int::Int; use std::convert::TryFrom; - fn get_client() -> Client { + fn get_client() -> BaseClient { let session = Session { access_token: "1234".to_owned(), user_id: UserId::try_from("@example:localhost").unwrap(), device_id: "DEVICEID".to_owned(), }; - Client::new(Some(session)).unwrap() + BaseClient::new(Some(session)).unwrap() } fn get_room_id() -> RoomId { diff --git a/matrix_sdk_base/src/state/mod.rs b/matrix_sdk_base/src/state/mod.rs index d6a3bf1a..a53ec622 100644 --- a/matrix_sdk_base/src/state/mod.rs +++ b/matrix_sdk_base/src/state/mod.rs @@ -19,7 +19,7 @@ use std::collections::HashMap; pub mod state_store; pub use state_store::JsonStore; -use crate::client::{Client as BaseClient, Token}; +use crate::client::{BaseClient, Token}; use crate::events::push_rules::Ruleset; use crate::identifiers::{RoomId, UserId}; use crate::{Result, Room, Session}; diff --git a/matrix_sdk_base/src/state/state_store.rs b/matrix_sdk_base/src/state/state_store.rs index 8917b389..e26f35b6 100644 --- a/matrix_sdk_base/src/state/state_store.rs +++ b/matrix_sdk_base/src/state/state_store.rs @@ -145,7 +145,7 @@ mod test { use crate::api::r0::sync::sync_events::Response as SyncResponse; use crate::identifiers::{RoomId, UserId}; - use crate::{Client, Session}; + use crate::{BaseClient, Session}; fn sync_response(file: &str) -> SyncResponse { let mut file = File::open(file).unwrap(); @@ -229,7 +229,7 @@ mod test { // a sync response to populate our JSON store let store = Box::new(JsonStore::open(path).unwrap()); - let client = Client::new_with_state_store(Some(session.clone()), store).unwrap(); + let client = BaseClient::new_with_state_store(Some(session.clone()), store).unwrap(); let mut response = sync_response("../test_data/sync.json"); @@ -238,7 +238,7 @@ mod test { // now syncing the client will update from the state store let store = Box::new(JsonStore::open(path).unwrap()); - let client = Client::new_with_state_store(Some(session.clone()), store).unwrap(); + let client = BaseClient::new_with_state_store(Some(session.clone()), store).unwrap(); client.sync_with_state_store().await.unwrap(); // assert the synced client and the logged in client are equal