Skip to content

Commit

Permalink
chore: Upgrade Ruma
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Nov 14, 2022
1 parent 680ef6b commit 4dc0e0e
Show file tree
Hide file tree
Showing 23 changed files with 174 additions and 152 deletions.
78 changes: 48 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ default-members = ["benchmarks", "crates/*"]
resolver = "2"

[workspace.dependencies]
ruma = { version = "0.7.4", features = ["client-api-c"] }
ruma = { git = "https://github.com/ruma/ruma", rev = "ed100afddb5fb30f1ccf368d7e712a3a483e63bf", features = ["client-api-c"] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "ed100afddb5fb30f1ccf368d7e712a3a483e63bf" }
tracing = { version = "0.1.36", default-features = false, features = ["std"] }
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "779e955f21a70e4aba43a7408f1841dcdf728b32" }
uniffi_macros = { git = "https://github.com/mozilla/uniffi-rs", rev = "779e955f21a70e4aba43a7408f1841dcdf728b32" }
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-crypto-ffi/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use ruma::{
upload_signatures::v3::Response as SignatureUploadResponse,
},
message::send_message_event::v3::Response as RoomMessageResponse,
sync::sync_events::v3::{DeviceLists as RumaDeviceLists, ToDevice},
sync::sync_events::{v3::ToDevice, DeviceLists as RumaDeviceLists},
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
},
IncomingResponse,
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-crypto-js/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ matrix-sdk-common = { version = "0.6.0", path = "../../crates/matrix-sdk-common"
matrix-sdk-crypto = { version = "0.6.0", path = "../../crates/matrix-sdk-crypto", features = ["js"] }
matrix-sdk-indexeddb = { version = "0.2.0", path = "../../crates/matrix-sdk-indexeddb", features = ["experimental-nodejs"] }
matrix-sdk-qrcode = { version = "0.4.0", path = "../../crates/matrix-sdk-qrcode", optional = true }
ruma = { workspace = true, features = ["js", "rand", "unstable-msc2676", "unstable-msc2677"] }
ruma = { workspace = true, features = ["js", "rand", "unstable-msc2677"] }
vodozemac = { workspace = true, features = ["js"] }
wasm-bindgen = "0.2.83"
wasm-bindgen-futures = "0.4.33"
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-crypto-nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tracing = ["dep:tracing-subscriber"]
matrix-sdk-crypto = { version = "0.6.0", path = "../../crates/matrix-sdk-crypto", features = ["js"] }
matrix-sdk-common = { version = "0.6.0", path = "../../crates/matrix-sdk-common", features = ["js"] }
matrix-sdk-sled = { version = "0.2.0", path = "../../crates/matrix-sdk-sled", default-features = false, features = ["crypto-store"] }
ruma = { workspace = true, features = ["rand", "unstable-msc2676", "unstable-msc2677"] }
ruma = { workspace = true, features = ["rand", "unstable-msc2677"] }
napi = { version = "2.9.1", default-features = false, features = ["napi6", "tokio_rt"] }
napi-derive = "2.9.1"
serde_json = "1.0.79"
Expand Down
16 changes: 7 additions & 9 deletions bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use matrix_sdk::{
serde::Raw,
TransactionId, UInt,
},
Client as MatrixClient, Error, LoopCtrl, RumaApiError,
Client as MatrixClient, Error, LoopCtrl,
};

use super::{
Expand Down Expand Up @@ -297,15 +297,13 @@ impl Client {

/// Process a sync error and return loop control accordingly
pub(crate) fn process_sync_error(&self, sync_error: Error) -> LoopCtrl {
if let Some(RumaApiError::ClientApi(error)) = sync_error.as_ruma_api_error() {
if let ErrorKind::UnknownToken { soft_logout } = error.kind {
self.state.write().unwrap().is_soft_logout = soft_logout;
if let Some(delegate) = &*self.delegate.read().unwrap() {
delegate.did_update_restore_token();
delegate.did_receive_auth_error(soft_logout);
}
return LoopCtrl::Break;
if let Some(ErrorKind::UnknownToken { soft_logout }) = sync_error.client_api_error_kind() {
self.state.write().unwrap().is_soft_logout = *soft_logout;
if let Some(delegate) = &*self.delegate.read().unwrap() {
delegate.did_update_restore_token();
delegate.did_receive_auth_error(*soft_logout);
}
return LoopCtrl::Break;
}

tracing::warn!("Ignoring sync error: {:?}", sync_error);
Expand Down
11 changes: 7 additions & 4 deletions bindings/matrix-sdk-ffi/src/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use matrix_sdk::{
Room as SdkRoom,
},
ruma::{
events::room::message::{Relation, Replacement, RoomMessageEvent, RoomMessageEventContent},
events::room::message::{
ForwardThread, MessageType, Relation, Replacement, RoomMessageEvent,
RoomMessageEventContent,
},
EventId, UserId,
},
};
Expand Down Expand Up @@ -191,8 +194,8 @@ impl Room {
let original_message =
event_content.as_original().context("Couldn't retrieve original message.")?;

let reply_content =
RoomMessageEventContent::text_markdown(msg).make_reply_to(original_message);
let reply_content = RoomMessageEventContent::text_markdown(msg)
.make_reply_to(original_message, ForwardThread::Yes);

timeline.send(reply_content.into(), txn_id.as_deref().map(Into::into)).await?;

Expand Down Expand Up @@ -233,7 +236,7 @@ impl Room {

let replacement = Replacement::new(
event_id.to_owned(),
Box::new(RoomMessageEventContent::text_markdown(new_msg.to_owned())),
MessageType::text_markdown(new_msg.to_owned()),
);

let mut edited_content = RoomMessageEventContent::text_markdown(new_msg);
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ matrix-sdk-common = { version = "0.6.0", path = "../matrix-sdk-common" }
olm-rs = { version = "2.2.0", features = ["serde"], optional = true }
pbkdf2 = { version = "0.11.0", default-features = false }
rand = "0.8.5"
ruma = { workspace = true, features = ["rand", "canonical-json", "unstable-msc2676", "unstable-msc2677"] }
ruma = { workspace = true, features = ["rand", "canonical-json", "unstable-msc2677"] }
serde = { version = "1.0.136", features = ["derive", "rc"] }
serde_json = "1.0.79"
sha2 = "0.10.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::collections::BTreeMap;
use matrix_sdk_crypto::{OlmMachine, OlmError};
use ruma::{
api::client::sync::sync_events::v3::{ToDevice, DeviceLists},
api::client::sync::sync_events::{v3::ToDevice, DeviceLists},
device_id, user_id,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ pub(crate) mod tests {
api::{
client::{
keys::{claim_keys, get_keys, upload_keys},
sync::sync_events::v3::DeviceLists,
sync::sync_events::DeviceLists,
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
},
IncomingResponse,
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-qrcode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"]
base64 = "0.13.0"
byteorder = "1.4.3"
qrcode = { version = "0.12.0", default-features = false }
ruma-common = "0.10.0"
ruma-common = { workspace = true }
thiserror = "1.0.30"
vodozemac = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ image-proc = ["dep:image"]
image-rayon = ["image-proc", "image?/jpeg_rayon"]

experimental-room-preview = []
experimental-timeline = ["ruma/unstable-msc2676", "ruma/unstable-msc2677"]
experimental-timeline = ["ruma/unstable-msc2677"]

sliding-sync = [
"matrix-sdk-base/sliding-sync",
Expand Down
9 changes: 6 additions & 3 deletions crates/matrix-sdk/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ impl Account {
/// if let Some(raw_content) = maybe_content {
/// let content = raw_content.deserialize()?;
/// println!("Ignored users:");
/// for user_id in content.ignored_users {
/// for user_id in content.ignored_users.keys() {
/// println!("- {user_id}");
/// }
/// }
Expand Down Expand Up @@ -676,7 +676,8 @@ impl Account {
/// # let client = Client::new("http://localhost:8080".parse()?).await?;
/// # let account = client.account();
/// use matrix_sdk::ruma::{
/// events::ignored_user_list::IgnoredUserListEventContent, user_id,
/// events::ignored_user_list::{IgnoredUser, IgnoredUserListEventContent},
/// user_id,
/// };
///
/// let mut content = account
Expand All @@ -685,7 +686,9 @@ impl Account {
/// .map(|c| c.deserialize())
/// .transpose()?
/// .unwrap_or_default();
/// content.ignored_users.push(user_id!("@foo:bar.com").to_owned());
/// content
/// .ignored_users
/// .insert(user_id!("@foo:bar.com").to_owned(), IgnoredUser::new());
/// account.set_account_data(content).await?;
/// # anyhow::Ok(()) };
/// ```
Expand Down
Loading

0 comments on commit 4dc0e0e

Please sign in to comment.