rust-sdk: Updates for the new ruma crate versions.

master
Damir Jelić 2020-04-03 14:09:56 +02:00
parent 12dc5212e3
commit 74f1a21e42
5 changed files with 11 additions and 9 deletions

View File

@ -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"

View File

@ -135,7 +135,7 @@ impl AsyncClientConfig {
pub struct SyncSettings {
pub(crate) timeout: Option<Duration>,
pub(crate) token: Option<String>,
pub(crate) full_state: Option<bool>,
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,
};

View File

@ -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::<EventResult<RoomEvent>>(decrypted_value)?;
trace!("Successfully decrypted megolm event {:?}", decrypted_event);

View File

@ -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(),
}

View File

@ -11,6 +11,7 @@
"invite": {},
"join": {
"!SVkFJHzfwvuaIEawgC:localhost": {
"summary": {},
"account_data": {
"events": [
{