diff --git a/matrix_sdk/Cargo.toml b/matrix_sdk/Cargo.toml index 8c36b379..48de3ded 100644 --- a/matrix_sdk/Cargo.toml +++ b/matrix_sdk/Cargo.toml @@ -19,9 +19,9 @@ sqlite-cryptostore = ["matrix-sdk-base/sqlite-cryptostore"] [dependencies] http = "0.2.1" reqwest = "0.10.4" -serde_json = "1.0.52" -thiserror = "1.0.16" -tracing = "0.1.13" +serde_json = "1.0.53" +thiserror = "1.0.17" +tracing = "0.1.14" url = "2.1.1" futures-timer = "3.0.2" @@ -39,14 +39,14 @@ default-features = false features = ["std", "std-future"] [dev-dependencies] -async-trait = "0.1.30" +async-trait = "0.1.31" dirs = "2.0.2" matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" } -tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } +tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] } ruma-identifiers = { version = "0.16.1", features = ["rand"] } -serde_json = "1.0.52" +serde_json = "1.0.53" tracing-subscriber = "0.2.5" tempfile = "3.1.0" mockito = "0.25.1" lazy_static = "1.4.0" -futures = "0.3.4" +futures = "0.3.5" diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 1d68fc47..b3ec59ee 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -37,7 +37,7 @@ use url::Url; use crate::events::room::message::MessageEventContent; use crate::events::EventType; -use crate::identifiers::{EventId, RoomId, UserId}; +use crate::identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId}; use crate::Endpoint; #[cfg(feature = "encryption")] @@ -224,7 +224,7 @@ use api::r0::keys::{claim_keys, get_keys, upload_keys, KeyAlgorithm}; use api::r0::membership::{ ban_user, forget_room, invite_user::{self, InvitationRecipient}, - join_room_by_id, kick_user, leave_room, Invite3pid, + join_room_by_id, join_room_by_id_or_alias, kick_user, leave_room, Invite3pid, }; use api::r0::message::create_message_event; use api::r0::message::get_message_events; @@ -473,27 +473,27 @@ impl Client { // TODO enable this once Ruma supports proper serialization of the query // string. - ///// Join a room by `RoomId`. - ///// - ///// Returns a `join_room_by_id_or_alias::Response` consisting of the - ///// joined rooms `RoomId`. - ///// - ///// # Arguments - ///// - ///// * `alias` - The `RoomId` or `RoomAliasId` of the room to be joined. - ///// An alias looks like this `#name:example.com` - //pub async fn join_room_by_id_or_alias( - // &self, - // alias: &RoomIdOrAliasId, - // server_names: &[String], - //) -> Result { - // let request = join_room_by_id_or_alias::Request { - // room_id_or_alias: alias.clone(), - // server_name: server_names.to_owned(), - // third_party_signed: None, - // }; - // self.send(request).await - //} + /// Join a room by `RoomId`. + /// + /// Returns a `join_room_by_id_or_alias::Response` consisting of the + /// joined rooms `RoomId`. + /// + /// # Arguments + /// + /// * `alias` - The `RoomId` or `RoomAliasId` of the room to be joined. + /// An alias looks like this `#name:example.com` + pub async fn join_room_by_id_or_alias( + &self, + alias: &RoomIdOrAliasId, + server_names: &[String], + ) -> Result { + let request = join_room_by_id_or_alias::Request { + room_id_or_alias: alias.clone(), + server_name: server_names.to_owned(), + third_party_signed: None, + }; + self.send(request).await + } /// Forget a room by `RoomId`. /// @@ -1240,7 +1240,7 @@ mod test { use crate::events::collections::all::RoomEvent; use crate::events::room::member::MembershipState; use crate::events::room::message::TextMessageEventContent; - use crate::identifiers::{EventId, RoomId, UserId}; + use crate::identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId}; use matrix_sdk_base::JsonStore; use matrix_sdk_test::{EventBuilder, EventsFile}; @@ -1380,37 +1380,37 @@ mod test { // TODO enable this once Ruma supports proper serialization of the query // string. - // #[tokio::test] - // async fn join_room_by_id_or_alias() { - // let homeserver = Url::from_str(&mockito::server_url()).unwrap(); + #[tokio::test] + async fn join_room_by_id_or_alias() { + let homeserver = Url::from_str(&mockito::server_url()).unwrap(); - // let session = Session { - // access_token: "1234".to_owned(), - // user_id: UserId::try_from("@example:localhost").unwrap(), - // device_id: "DEVICEID".to_owned(), - // }; + let session = Session { + access_token: "1234".to_owned(), + user_id: UserId::try_from("@example:localhost").unwrap(), + device_id: "DEVICEID".to_owned(), + }; - // let _m = mock( - // "POST", - // Matcher::Regex(r"^/_matrix/client/r0/join/".to_string()), - // ) - // .with_status(200) - // .with_body_from_file("../test_data/room_id.json") - // .create(); + let _m = mock( + "POST", + Matcher::Regex(r"^/_matrix/client/r0/join/".to_string()), + ) + .with_status(200) + .with_body_from_file("../test_data/room_id.json") + .create(); - // let client = Client::new(homeserver, Some(session)).unwrap(); - // let room_id = RoomIdOrAliasId::try_from("!testroom:example.org").unwrap(); + let client = Client::new(homeserver, Some(session)).unwrap(); + let room_id = RoomIdOrAliasId::try_from("!testroom:example.org").unwrap(); - // assert_eq!( - // // this is the `join_by_room_id::Response` but since no PartialEq we check the RoomId field - // client - // .join_room_by_id_or_alias(&room_id, &["server.com".to_string()]) - // .await - // .unwrap() - // .room_id, - // RoomId::try_from("!testroom:example.org").unwrap() - // ); - // } + assert_eq!( + // this is the `join_by_room_id::Response` but since no PartialEq we check the RoomId field + client + .join_room_by_id_or_alias(&room_id, &["server.com".to_string()]) + .await + .unwrap() + .room_id, + RoomId::try_from("!testroom:example.org").unwrap() + ); + } #[tokio::test] #[allow(irrefutable_let_patterns)] diff --git a/matrix_sdk_base/Cargo.toml b/matrix_sdk_base/Cargo.toml index 2b98df27..2dea9b8b 100644 --- a/matrix_sdk_base/Cargo.toml +++ b/matrix_sdk_base/Cargo.toml @@ -17,18 +17,18 @@ encryption = ["matrix-sdk-crypto"] sqlite-cryptostore = ["matrix-sdk-crypto/sqlite-cryptostore"] [dependencies] -async-trait = "0.1.30" -serde = "1.0.106" -serde_json = "1.0.52" +async-trait = "0.1.31" +serde = "1.0.110" +serde_json = "1.0.53" matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } matrix-sdk-crypto = { version = "0.1.0", path = "../matrix_sdk_crypto", optional = true } # Misc dependencies -thiserror = "1.0.16" +thiserror = "1.0.17" [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] -version = "0.2.20" +version = "0.2.21" default-features = false features = ["sync", "fs"] @@ -40,7 +40,7 @@ tracing-subscriber = "0.2.5" tempfile = "3.1.0" [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } +tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = "0.3.12" \ No newline at end of file +wasm-bindgen-test = "0.3.12" diff --git a/matrix_sdk_common/Cargo.toml b/matrix_sdk_common/Cargo.toml index fd822ed7..e0e77563 100644 --- a/matrix_sdk_common/Cargo.toml +++ b/matrix_sdk_common/Cargo.toml @@ -12,7 +12,7 @@ version = "0.1.0" [dependencies] js_int = "0.1.5" -ruma-api = "0.16.0" +ruma-api = "0.16.1" ruma-client-api = "0.8.0" ruma-events = "0.21.1" ruma-identifiers = "0.16.1" @@ -22,7 +22,7 @@ instant = { version = "0.1.3", features = ["wasm-bindgen", "now"] } uuid = { version = "0.8.1", features = ["v4"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] -version = "0.2.20" +version = "0.2.21" default-features = false features = ["sync", "time", "fs"] diff --git a/matrix_sdk_crypto/Cargo.toml b/matrix_sdk_crypto/Cargo.toml index 12b9c2ab..d5a79c49 100644 --- a/matrix_sdk_crypto/Cargo.toml +++ b/matrix_sdk_crypto/Cargo.toml @@ -15,20 +15,20 @@ default = [] sqlite-cryptostore = ["sqlx"] [dependencies] -async-trait = "0.1.30" +async-trait = "0.1.31" matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } olm-rs = { version = "0.5.0", features = ["serde"] } -serde = { version = "1.0.106", features = ["derive"] } -serde_json = "1.0.52" +serde = { version = "1.0.110", features = ["derive"] } +serde_json = "1.0.53" cjson = "0.1.0" zeroize = { version = "1.1.0", features = ["zeroize_derive"] } url = "2.1.1" # Misc dependencies -thiserror = "1.0.16" -tracing = "0.1.13" +thiserror = "1.0.17" +tracing = "0.1.14" atomic = "0.4.5" dashmap = "3.11.1" @@ -44,8 +44,8 @@ default-features = false features = ["runtime-tokio", "sqlite"] [dev-dependencies] -tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } +tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] } ruma-identifiers = { version = "0.16.1", features = ["rand"] } -serde_json = "1.0.52" +serde_json = "1.0.53" tempfile = "3.1.0" http = "0.2.1" diff --git a/matrix_sdk_test/Cargo.toml b/matrix_sdk_test/Cargo.toml index 65650f76..05dd4eac 100644 --- a/matrix_sdk_test/Cargo.toml +++ b/matrix_sdk_test/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/matrix-org/matrix-rust-sdk" version = "0.1.0" [dependencies] -serde_json = "1.0.52" +serde_json = "1.0.53" http = "0.2.1" matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } -matrix-sdk-test-macros = { path = "../matrix_sdk_test_macros" } \ No newline at end of file +matrix-sdk-test-macros = { path = "../matrix_sdk_test_macros" }