rust-sdk: Updates for the new ruma crate versions.
parent
12dc5212e3
commit
74f1a21e42
|
@ -26,8 +26,8 @@ async-trait = "0.1.26"
|
||||||
# Ruma dependencies
|
# Ruma dependencies
|
||||||
js_int = "0.1.3"
|
js_int = "0.1.3"
|
||||||
ruma-api = "0.15.0-dev.1"
|
ruma-api = "0.15.0-dev.1"
|
||||||
ruma-client-api = { git = "https://github.com/matrix-org/ruma-client-api/", version = "0.6.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.17.0" }
|
ruma-events = { git = "https://github.com/matrix-org/ruma-events", version = "0.18.0" }
|
||||||
ruma-identifiers = "0.14.1"
|
ruma-identifiers = "0.14.1"
|
||||||
|
|
||||||
# Dependencies for the encryption support
|
# Dependencies for the encryption support
|
||||||
|
@ -61,6 +61,7 @@ features = ["runtime-tokio", "sqlite"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "0.2.13", features = ["rt-threaded", "macros"] }
|
tokio = { version = "0.2.13", features = ["rt-threaded", "macros"] }
|
||||||
|
serde_json = { version = "1.0.49" }
|
||||||
tracing-subscriber = "0.2.3"
|
tracing-subscriber = "0.2.3"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
mockito = "0.23.3"
|
mockito = "0.23.3"
|
||||||
|
|
|
@ -135,7 +135,7 @@ impl AsyncClientConfig {
|
||||||
pub struct SyncSettings {
|
pub struct SyncSettings {
|
||||||
pub(crate) timeout: Option<Duration>,
|
pub(crate) timeout: Option<Duration>,
|
||||||
pub(crate) token: Option<String>,
|
pub(crate) token: Option<String>,
|
||||||
pub(crate) full_state: Option<bool>,
|
pub(crate) full_state: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyncSettings {
|
impl SyncSettings {
|
||||||
|
@ -173,7 +173,7 @@ impl SyncSettings {
|
||||||
/// * `full_state` - A boolean deciding if the server should return the full
|
/// * `full_state` - A boolean deciding if the server should return the full
|
||||||
/// state or not.
|
/// state or not.
|
||||||
pub fn full_state(mut self, full_state: bool) -> Self {
|
pub fn full_state(mut self, full_state: bool) -> Self {
|
||||||
self.full_state = Some(full_state);
|
self.full_state = full_state;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ impl AsyncClient {
|
||||||
filter: None,
|
filter: None,
|
||||||
since: sync_settings.token,
|
since: sync_settings.token,
|
||||||
full_state: sync_settings.full_state,
|
full_state: sync_settings.full_state,
|
||||||
set_presence: None,
|
set_presence: sync_events::SetPresence::Online,
|
||||||
timeout: sync_settings.timeout,
|
timeout: sync_settings.timeout,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -917,9 +917,7 @@ impl OlmMachine {
|
||||||
decrypted_object.insert("event_id".to_owned(), event.event_id.to_string().into());
|
decrypted_object.insert("event_id".to_owned(), event.event_id.to_string().into());
|
||||||
decrypted_object.insert("origin_server_ts".to_owned(), server_ts.into());
|
decrypted_object.insert("origin_server_ts".to_owned(), server_ts.into());
|
||||||
|
|
||||||
if let Some(unsigned) = &event.unsigned {
|
decrypted_object.insert("unsigned".to_owned(), event.unsigned.clone().into());
|
||||||
decrypted_object.insert("unsigned".to_owned(), unsigned.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
let decrypted_event = serde_json::from_value::<EventResult<RoomEvent>>(decrypted_value)?;
|
let decrypted_event = serde_json::from_value::<EventResult<RoomEvent>>(decrypted_value)?;
|
||||||
trace!("Successfully decrypted megolm event {:?}", decrypted_event);
|
trace!("Successfully decrypted megolm event {:?}", decrypted_event);
|
||||||
|
|
|
@ -119,6 +119,8 @@ mod test {
|
||||||
use crate::identifiers::{EventId, RoomId, UserId};
|
use crate::identifiers::{EventId, RoomId, UserId};
|
||||||
use crate::{AsyncClient, Session, SyncSettings};
|
use crate::{AsyncClient, Session, SyncSettings};
|
||||||
|
|
||||||
|
use serde_json;
|
||||||
|
|
||||||
use js_int::{Int, UInt};
|
use js_int::{Int, UInt};
|
||||||
use mockito::{mock, Matcher};
|
use mockito::{mock, Matcher};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -190,7 +192,7 @@ mod test {
|
||||||
origin_server_ts: UInt::new(1520372800469).unwrap(),
|
origin_server_ts: UInt::new(1520372800469).unwrap(),
|
||||||
prev_content: None,
|
prev_content: None,
|
||||||
room_id: RoomId::try_from("!roomid:room.com").ok(),
|
room_id: RoomId::try_from("!roomid:room.com").ok(),
|
||||||
unsigned: None,
|
unsigned: serde_json::Map::new(),
|
||||||
sender: UserId::try_from("@example:example.com").unwrap(),
|
sender: UserId::try_from("@example:example.com").unwrap(),
|
||||||
state_key: "@example:example.com".into(),
|
state_key: "@example:example.com".into(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"invite": {},
|
"invite": {},
|
||||||
"join": {
|
"join": {
|
||||||
"!SVkFJHzfwvuaIEawgC:localhost": {
|
"!SVkFJHzfwvuaIEawgC:localhost": {
|
||||||
|
"summary": {},
|
||||||
"account_data": {
|
"account_data": {
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue