diff --git a/Cargo.toml b/Cargo.toml index 3e5184e6..38d65fe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,8 +26,8 @@ async-trait = "0.1.26" # Ruma dependencies js_int = "0.1.3" ruma-api = "0.15.0-dev.1" -ruma-client-api = { git = "https://github.com/matrix-org/ruma-client-api/", version = "0.6.0" } -ruma-events = { git = "https://github.com/matrix-org/ruma-events", version = "0.17.0" } +ruma-client-api = { git = "https://github.com/matrix-org/ruma-client-api/", version = "0.7.0" } +ruma-events = { git = "https://github.com/matrix-org/ruma-events", version = "0.18.0" } ruma-identifiers = "0.14.1" # Dependencies for the encryption support @@ -61,6 +61,7 @@ features = ["runtime-tokio", "sqlite"] [dev-dependencies] tokio = { version = "0.2.13", features = ["rt-threaded", "macros"] } +serde_json = { version = "1.0.49" } tracing-subscriber = "0.2.3" tempfile = "3.1.0" mockito = "0.23.3" diff --git a/src/async_client.rs b/src/async_client.rs index 8128339d..0e5e61e8 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -135,7 +135,7 @@ impl AsyncClientConfig { pub struct SyncSettings { pub(crate) timeout: Option, pub(crate) token: Option, - pub(crate) full_state: Option, + pub(crate) full_state: bool, } impl SyncSettings { @@ -173,7 +173,7 @@ impl SyncSettings { /// * `full_state` - A boolean deciding if the server should return the full /// state or not. pub fn full_state(mut self, full_state: bool) -> Self { - self.full_state = Some(full_state); + self.full_state = full_state; self } } @@ -347,7 +347,7 @@ impl AsyncClient { filter: None, since: sync_settings.token, full_state: sync_settings.full_state, - set_presence: None, + set_presence: sync_events::SetPresence::Online, timeout: sync_settings.timeout, }; diff --git a/src/crypto/machine.rs b/src/crypto/machine.rs index 16089ed2..48d678ab 100644 --- a/src/crypto/machine.rs +++ b/src/crypto/machine.rs @@ -917,9 +917,7 @@ impl OlmMachine { decrypted_object.insert("event_id".to_owned(), event.event_id.to_string().into()); decrypted_object.insert("origin_server_ts".to_owned(), server_ts.into()); - if let Some(unsigned) = &event.unsigned { - decrypted_object.insert("unsigned".to_owned(), unsigned.clone()); - } + decrypted_object.insert("unsigned".to_owned(), event.unsigned.clone().into()); let decrypted_event = serde_json::from_value::>(decrypted_value)?; trace!("Successfully decrypted megolm event {:?}", decrypted_event); diff --git a/src/models/room_member.rs b/src/models/room_member.rs index 4390f5e8..ad93b342 100644 --- a/src/models/room_member.rs +++ b/src/models/room_member.rs @@ -119,6 +119,8 @@ mod test { use crate::identifiers::{EventId, RoomId, UserId}; use crate::{AsyncClient, Session, SyncSettings}; + use serde_json; + use js_int::{Int, UInt}; use mockito::{mock, Matcher}; use url::Url; @@ -190,7 +192,7 @@ mod test { origin_server_ts: UInt::new(1520372800469).unwrap(), prev_content: None, room_id: RoomId::try_from("!roomid:room.com").ok(), - unsigned: None, + unsigned: serde_json::Map::new(), sender: UserId::try_from("@example:example.com").unwrap(), state_key: "@example:example.com".into(), } diff --git a/tests/data/sync.json b/tests/data/sync.json index 32cd4629..a6aaeaba 100644 --- a/tests/data/sync.json +++ b/tests/data/sync.json @@ -11,6 +11,7 @@ "invite": {}, "join": { "!SVkFJHzfwvuaIEawgC:localhost": { + "summary": {}, "account_data": { "events": [ {