[fractal/fractal-next] chore: Update matrix-sdk
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] chore: Update matrix-sdk
- Date: Wed, 30 Mar 2022 12:20:00 +0000 (UTC)
commit a6cd20aca9deec8331f4ea4461e20c0071740b07
Author: Kévin Commaille <zecakeh tedomum fr>
Date: Tue Mar 29 15:45:13 2022 +0200
chore: Update matrix-sdk
Cargo.lock | 195 ++++-----------------
Cargo.toml | 5 +
src/components/auth_dialog.rs | 2 +-
src/login/mod.rs | 5 +-
src/secret.rs | 2 +-
.../account_settings/devices_page/device.rs | 3 +-
.../user_page/change_password_subpage.rs | 2 +-
src/session/account_settings/user_page/mod.rs | 2 +-
src/session/avatar.rs | 11 +-
src/session/content/explore/mod.rs | 2 +-
src/session/content/explore/public_room.rs | 5 +-
src/session/content/explore/public_room_list.rs | 3 +-
.../content/room_details/invite_subpage/invitee.rs | 2 +-
.../room_details/invite_subpage/invitee_list.rs | 2 +-
src/session/content/room_details/mod.rs | 8 +-
.../content/room_history/message_row/audio.rs | 2 +-
.../content/room_history/message_row/media.rs | 39 +++--
.../content/room_history/message_row/mod.rs | 10 +-
src/session/content/room_history/state_row/mod.rs | 4 +-
src/session/media_viewer.rs | 5 +-
src/session/mod.rs | 9 +-
src/session/room/event.rs | 99 +++++------
src/session/room/event_actions.rs | 4 +-
src/session/room/item.rs | 5 +-
src/session/room/member.rs | 2 +-
src/session/room/mod.rs | 17 +-
src/session/room/power_levels.rs | 8 +-
src/session/room/reaction_list.rs | 6 +-
src/session/room/timeline.rs | 22 +--
src/session/room_creation/mod.rs | 9 +-
src/session/room_list.rs | 2 +-
src/session/user.rs | 2 +-
src/session/verification/identity_verification.rs | 11 +-
src/session/verification/verification_list.rs | 2 +-
src/user_facing_error.rs | 2 +-
src/utils.rs | 15 +-
36 files changed, 199 insertions(+), 325 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 95f528f71..a0128d8c5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1030,6 +1030,7 @@ dependencies = [
"qrcode",
"rand 0.8.5",
"regex",
+ "ruma",
"serde",
"serde_json",
"sourceview5",
@@ -2343,22 +2344,22 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "matrix-qrcode"
version = "0.2.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"base64",
"byteorder",
"image",
"qrcode",
"rqrr",
- "ruma-identifiers",
- "ruma-serde",
+ "ruma-common",
"thiserror",
+ "vodozemac",
]
[[package]]
name = "matrix-sdk"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"anymap2",
"async-stream",
@@ -2391,7 +2392,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-base"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"anyhow",
"async-stream",
@@ -2418,7 +2419,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-common"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"async-lock",
"async-trait",
@@ -2434,7 +2435,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-crypto"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"aes 0.7.5",
"aes-gcm",
@@ -2462,7 +2463,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-sled"
version = "0.1.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"anyhow",
"async-stream",
@@ -2484,7 +2485,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-store-encryption"
version = "0.1.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#28893ec38886346c14b2f58e3e9511d53a82d1a9"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
dependencies = [
"blake3",
"chacha20poly1305",
@@ -3484,57 +3485,21 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "377d836ac9faf53c56aa8610c596be4d2e0881600b20d0c4a3a09694989f664f"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"assign",
"js_int",
- "ruma-api",
"ruma-client-api",
"ruma-common",
- "ruma-events",
"ruma-federation-api",
- "ruma-identifiers",
- "ruma-serde",
"ruma-signatures",
"ruma-state-res",
]
-[[package]]
-name = "ruma-api"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fc1c16c9b7d21791e4c2d082da3d050ea1cebe004af30275fb2e6f547e1a283"
-dependencies = [
- "bytes",
- "http",
- "percent-encoding",
- "ruma-api-macros",
- "ruma-identifiers",
- "ruma-serde",
- "serde",
- "serde_json",
- "thiserror",
- "tracing",
-]
-
-[[package]]
-name = "ruma-api-macros"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cc6143101ea576d8763468a3b8889c5d9062402204d172bde3b99912a16e5cc"
-dependencies = [
- "proc-macro-crate",
- "proc-macro2 1.0.36",
- "quote 1.0.15",
- "syn 1.0.86",
-]
-
[[package]]
name = "ruma-client-api"
version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d360ec8cdb7e0815b8b6ab06345c68972aa2e7c564578cd05f3eb2845a785a9"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"assign",
"bytes",
@@ -3542,11 +3507,7 @@ dependencies = [
"js_int",
"maplit",
"percent-encoding",
- "ruma-api",
"ruma-common",
- "ruma-events",
- "ruma-identifiers",
- "ruma-serde",
"serde",
"serde_json",
]
@@ -3554,154 +3515,72 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98080b1aac4045f5988ae5e2ccfe1864487c151c1717d29fe1388b7e06383d3e"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
+ "base64",
+ "bytes",
+ "form_urlencoded",
+ "http",
"indexmap",
- "js_int",
- "ruma-identifiers",
- "ruma-serde",
- "serde",
- "serde_json",
- "tracing",
- "wildmatch",
-]
-
-[[package]]
-name = "ruma-events"
-version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2b661cc7dd619039c99aea1e42c06e3ac9a29a1d648dc3bcbb4f0dffcb49d04"
-dependencies = [
"indoc",
+ "itoa",
"js_int",
+ "percent-encoding",
"pulldown-cmark",
- "ruma-common",
- "ruma-events-macros",
- "ruma-identifiers",
- "ruma-serde",
+ "rand 0.8.5",
+ "ruma-identifiers-validation",
+ "ruma-macros",
"serde",
"serde_json",
"thiserror",
+ "tracing",
+ "url",
+ "uuid",
"wildmatch",
]
-[[package]]
-name = "ruma-events-macros"
-version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e9f4f3ac886d490d030bd3c5e50d21b80de5537bde04dd4529e27a0cc1e2201"
-dependencies = [
- "proc-macro-crate",
- "proc-macro2 1.0.36",
- "quote 1.0.15",
- "syn 1.0.86",
-]
-
[[package]]
name = "ruma-federation-api"
version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf1c02bf70a1cde9cf7d014544f1f63dee122ba7026a3b5535a9fc4f3ab888cd"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"js_int",
- "ruma-api",
"ruma-common",
- "ruma-events",
- "ruma-identifiers",
- "ruma-serde",
"serde",
"serde_json",
]
-[[package]]
-name = "ruma-identifiers"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7bc99002443cfdf64d1158e8e6e280b3633e17d91049ad9516ad475358b3b8b"
-dependencies = [
- "percent-encoding",
- "rand 0.8.5",
- "ruma-identifiers-macros",
- "ruma-identifiers-validation 0.7.0",
- "ruma-serde",
- "ruma-serde-macros",
- "serde",
- "url",
- "uuid",
-]
-
-[[package]]
-name = "ruma-identifiers-macros"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "503738488e3a378677e8b159478dbb07d2d70f1e1f3320c0bd3a51a99e44cf7c"
-dependencies = [
- "quote 1.0.15",
- "ruma-identifiers-validation 0.6.0",
- "syn 1.0.86",
-]
-
-[[package]]
-name = "ruma-identifiers-validation"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c670c45c3c86eaf5ff9b4bfd66a2a57116f2d808c9f8cbfc957cd34c48032ff9"
-dependencies = [
- "thiserror",
- "url",
-]
-
[[package]]
name = "ruma-identifiers-validation"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dc675917d537c870035d4681d7a2b939683fb908bbc036aa55889b09c5794f1"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"thiserror",
"url",
]
[[package]]
-name = "ruma-serde"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d44a6e4aabe679009ba0e26d37b43ea725591fcb3c82724bcfc0c3823d807cf"
-dependencies = [
- "base64",
- "bytes",
- "form_urlencoded",
- "itoa",
- "js_int",
- "ruma-serde-macros",
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "ruma-serde-macros"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d38cd6f6edebc09b9e4b4ecb24279dae0b700ecfc3a2d5eff9f8b60c41f73c03"
+name = "ruma-macros"
+version = "0.1.0"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"proc-macro-crate",
"proc-macro2 1.0.36",
"quote 1.0.15",
+ "ruma-identifiers-validation",
"syn 1.0.86",
]
[[package]]
name = "ruma-signatures"
version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f08deeb5241428e6f1db085bc0ae6aeb469d20f45164a7f5500901add47770d"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"base64",
"ed25519-dalek",
"pkcs8",
"rand 0.7.3",
- "ruma-identifiers",
- "ruma-serde",
+ "ruma-common",
"serde_json",
"sha2 0.9.9",
"thiserror",
@@ -3711,15 +3590,11 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c3328d01db08c51a66ac4093dd42151376a20fffebc6763a886d3e6d59d1ebc"
+source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
dependencies = [
"itertools",
"js_int",
"ruma-common",
- "ruma-events",
- "ruma-identifiers",
- "ruma-serde",
"serde",
"serde_json",
"thiserror",
@@ -4597,7 +4472,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vodozemac"
version = "0.1.0"
-source =
"git+https://github.com/matrix-org/vodozemac?rev=71a811026de9076922434381fa593f4184bf5a37#71a811026de9076922434381fa593f4184bf5a37"
+source =
"git+https://github.com/matrix-org/vodozemac?rev=16fb254aa3325c61ef949314c81c35f91d0664e1#16fb254aa3325c61ef949314c81c35f91d0664e1"
dependencies = [
"aes 0.8.1",
"arrayvec 0.7.2",
diff --git a/Cargo.toml b/Cargo.toml
index 8c0c40284..db341abcd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,3 +69,8 @@ features = [
"sso_login",
"markdown",
]
+
+[dependencies.ruma]
+git = "https://github.com/ruma/ruma.git"
+rev = "deea762b8"
+features = ["unstable-pre-spec", "client-api-c"]
diff --git a/src/components/auth_dialog.rs b/src/components/auth_dialog.rs
index fdb50b698..d286320f0 100644
--- a/src/components/auth_dialog.rs
+++ b/src/components/auth_dialog.rs
@@ -249,7 +249,7 @@ impl AuthDialog {
let uiaa_info: UiaaInfo = match response {
Ok(result) => return Ok(result),
- Err(Error::Http(UiaaError(FromHttpResponseError::Http(ServerError::Known(
+ Err(Error::Http(UiaaError(FromHttpResponseError::Server(ServerError::Known(
UiaaResponse::AuthResponse(uiaa_info),
))))) => uiaa_info,
Err(error) => return Err(AuthError::ServerResponse(Box::new(error))),
diff --git a/src/login/mod.rs b/src/login/mod.rs
index 23ad4aa41..845b51b79 100644
--- a/src/login/mod.rs
+++ b/src/login/mod.rs
@@ -9,8 +9,7 @@ use matrix_sdk::{
LoginType::{Password, Sso},
SsoLoginType,
},
- identifiers::Error as IdentifierError,
- ServerName,
+ IdParseError, ServerName,
},
Client,
};
@@ -633,7 +632,7 @@ impl Default for Login {
}
}
-fn build_server_name(server: &str) -> Result<Box<ServerName>, IdentifierError> {
+fn build_server_name(server: &str) -> Result<Box<ServerName>, IdParseError> {
let server = server
.strip_prefix("http://")
.or_else(|| server.strip_prefix("https://"))
diff --git a/src/secret.rs b/src/secret.rs
index 91bdd679d..1cb1be694 100644
--- a/src/secret.rs
+++ b/src/secret.rs
@@ -7,7 +7,7 @@ use libsecret::{
Retrievable, Schema, SchemaAttributeType, SchemaFlags, SearchFlags, Value, COLLECTION_DEFAULT,
};
use log::error;
-use matrix_sdk::ruma::identifiers::{DeviceId, UserId};
+use matrix_sdk::ruma::{DeviceId, UserId};
use serde::{Deserialize, Serialize};
use serde_json::error::Error as JsonError;
use url::Url;
diff --git a/src/session/account_settings/devices_page/device.rs
b/src/session/account_settings/devices_page/device.rs
index 4b17d2f12..f6a64bca0 100644
--- a/src/session/account_settings/devices_page/device.rs
+++ b/src/session/account_settings/devices_page/device.rs
@@ -3,8 +3,7 @@ use matrix_sdk::{
encryption::identities::Device as CryptoDevice,
ruma::{
api::client::device::{delete_device, Device as MatrixDevice},
- assign,
- identifiers::DeviceId,
+ assign, DeviceId,
},
};
diff --git a/src/session/account_settings/user_page/change_password_subpage.rs
b/src/session/account_settings/user_page/change_password_subpage.rs
index b80710828..e8a0a1dca 100644
--- a/src/session/account_settings/user_page/change_password_subpage.rs
+++ b/src/session/account_settings/user_page/change_password_subpage.rs
@@ -320,7 +320,7 @@ impl ChangePasswordSubpage {
AuthError::UserCancelled => {}
AuthError::ServerResponse(error)
if matches!(error.as_ref(), MatrixError::Http(HttpError::ClientApi(
- FromHttpResponseError::Http(ServerError::Known(error)),
+ FromHttpResponseError::Server(ServerError::Known(error)),
)) if error.kind.as_ref() == "M_WEAK_PASSWORD") =>
{
error!("Weak password: {:?}", error);
diff --git a/src/session/account_settings/user_page/mod.rs b/src/session/account_settings/user_page/mod.rs
index c1053e8a1..e9faa1319 100644
--- a/src/session/account_settings/user_page/mod.rs
+++ b/src/session/account_settings/user_page/mod.rs
@@ -9,7 +9,7 @@ use gtk::{
CompositeTemplate,
};
use log::error;
-use matrix_sdk::ruma::{api::client::capabilities::get_capabilities, MxcUri};
+use matrix_sdk::ruma::{api::client::discovery::get_capabilities, MxcUri};
mod change_password_subpage;
mod deactivate_account_subpage;
diff --git a/src/session/avatar.rs b/src/session/avatar.rs
index 3b5efb3f9..3f4252839 100644
--- a/src/session/avatar.rs
+++ b/src/session/avatar.rs
@@ -3,12 +3,15 @@ use std::path::Path;
use gtk::{gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use log::{debug, error, info};
use matrix_sdk::{
- media::{MediaFormat, MediaRequest, MediaThumbnailSize, MediaType},
+ media::{MediaFormat, MediaRequest, MediaThumbnailSize},
room::Room as MatrixRoom,
ruma::{
api::client::media::get_content_thumbnail::v3::Method,
- events::{room::avatar::RoomAvatarEventContent, AnyStateEventContent},
- identifiers::MxcUri,
+ events::{
+ room::{avatar::RoomAvatarEventContent, MediaSource},
+ AnyStateEventContent,
+ },
+ MxcUri,
},
Client,
};
@@ -165,7 +168,7 @@ impl Avatar {
let client = self.session().client();
let needed_size = self.needed_size();
let request = MediaRequest {
- media_type: MediaType::Uri(url),
+ source: MediaSource::Plain(url),
format: MediaFormat::Thumbnail(MediaThumbnailSize {
width: needed_size.into(),
height: needed_size.into(),
diff --git a/src/session/content/explore/mod.rs b/src/session/content/explore/mod.rs
index e908ad7af..d7dbbac4a 100644
--- a/src/session/content/explore/mod.rs
+++ b/src/session/content/explore/mod.rs
@@ -5,7 +5,7 @@ mod public_room_row;
use adw::subclass::prelude::*;
use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
use log::error;
-use matrix_sdk::ruma::api::client::thirdparty::get_protocols;
+use ruma::api::client::thirdparty::get_protocols;
pub use self::{
public_room::PublicRoom, public_room_list::PublicRoomList, public_room_row::PublicRoomRow,
diff --git a/src/session/content/explore/public_room.rs b/src/session/content/explore/public_room.rs
index 4c9dfb1b2..df3df63f3 100644
--- a/src/session/content/explore/public_room.rs
+++ b/src/session/content/explore/public_room.rs
@@ -1,8 +1,5 @@
use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
-use matrix_sdk::ruma::{
- directory::PublicRoomsChunk,
- identifiers::{RoomId, RoomOrAliasId},
-};
+use matrix_sdk::ruma::{directory::PublicRoomsChunk, RoomId, RoomOrAliasId};
use crate::session::{room::Room, Avatar, RoomList};
diff --git a/src/session/content/explore/public_room_list.rs b/src/session/content/explore/public_room_list.rs
index 4f9409e2f..c0967b1b8 100644
--- a/src/session/content/explore/public_room_list.rs
+++ b/src/session/content/explore/public_room_list.rs
@@ -8,8 +8,7 @@ use matrix_sdk::ruma::{
},
assign,
directory::{Filter, RoomNetwork},
- identifiers::ServerName,
- uint,
+ uint, ServerName,
};
use crate::{
diff --git a/src/session/content/room_details/invite_subpage/invitee.rs
b/src/session/content/room_details/invite_subpage/invitee.rs
index cce5d7acc..05226f6f8 100644
--- a/src/session/content/room_details/invite_subpage/invitee.rs
+++ b/src/session/content/room_details/invite_subpage/invitee.rs
@@ -1,5 +1,5 @@
use gtk::{glib, prelude::*, subclass::prelude::*};
-use matrix_sdk::ruma::identifiers::{MxcUri, UserId};
+use matrix_sdk::ruma::{MxcUri, UserId};
use crate::session::{user::UserExt, Session, User};
diff --git a/src/session/content/room_details/invite_subpage/invitee_list.rs
b/src/session/content/room_details/invite_subpage/invitee_list.rs
index 04f4a5358..9e49aa387 100644
--- a/src/session/content/room_details/invite_subpage/invitee_list.rs
+++ b/src/session/content/room_details/invite_subpage/invitee_list.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use log::error;
use matrix_sdk::{
- ruma::{api::client::user_directory::search_users, identifiers::UserId},
+ ruma::{api::client::user_directory::search_users, UserId},
HttpError,
};
diff --git a/src/session/content/room_details/mod.rs b/src/session/content/room_details/mod.rs
index e6b35f4a6..445dbfd0f 100644
--- a/src/session/content/room_details/mod.rs
+++ b/src/session/content/room_details/mod.rs
@@ -9,7 +9,7 @@ use gtk::{
subclass::prelude::*,
CompositeTemplate,
};
-use matrix_sdk::ruma::events::EventType;
+use matrix_sdk::ruma::events::RoomEventType;
pub use self::{invite_subpage::InviteSubpage, member_page::MemberPage};
use crate::{
@@ -156,7 +156,7 @@ impl RoomDetails {
));
let room_avatar_changeable =
- room.new_allowed_expr(RoomAction::StateEvent(EventType::RoomAvatar));
+ room.new_allowed_expr(RoomAction::StateEvent(RoomEventType::RoomAvatar));
let room_avatar_removable = and_expr(&room_avatar_changeable, &room_avatar_exists);
room_avatar_removable.bind(&avatar_remove_button.get(), "visible", gtk::Widget::NONE);
@@ -200,9 +200,9 @@ impl RoomDetails {
// Hide edit controls when the user is not eligible to perform the actions.
let room = self.room();
let room_name_changeable =
- room.new_allowed_expr(RoomAction::StateEvent(EventType::RoomName));
+ room.new_allowed_expr(RoomAction::StateEvent(RoomEventType::RoomName));
let room_topic_changeable =
- room.new_allowed_expr(RoomAction::StateEvent(EventType::RoomTopic));
+ room.new_allowed_expr(RoomAction::StateEvent(RoomEventType::RoomTopic));
let edit_toggle_visible = or_expr(room_name_changeable, room_topic_changeable);
edit_toggle_visible.bind(&edit_toggle.get(), "visible", gtk::Widget::NONE);
diff --git a/src/session/content/room_history/message_row/audio.rs
b/src/session/content/room_history/message_row/audio.rs
index e2ed8e87e..f7bfa41fa 100644
--- a/src/session/content/room_history/message_row/audio.rs
+++ b/src/session/content/room_history/message_row/audio.rs
@@ -211,7 +211,7 @@ impl MessageAudio {
self.set_state(MediaState::Loading);
let mut path = glib::tmp_dir();
- path.push(media_type_uid(audio.file()));
+ path.push(media_type_uid(audio.source()));
let file = gio::File::for_path(path);
if file.query_exists(gio::Cancellable::NONE) {
diff --git a/src/session/content/room_history/message_row/media.rs
b/src/session/content/room_history/message_row/media.rs
index d2132ab09..9a122e6a0 100644
--- a/src/session/content/room_history/message_row/media.rs
+++ b/src/session/content/room_history/message_row/media.rs
@@ -382,29 +382,30 @@ impl MessageMedia {
let client = session.client();
let handle = spawn_tokio!(async move {
- let thumbnail = if media_type != MediaType::Video && content.thumbnail().is_some() {
- client
- .get_thumbnail(
- content.clone(),
- MediaThumbnailSize {
- method: Method::Scale,
- width: uint!(320),
- height: uint!(240),
- },
- true,
- )
- .await
- .ok()
- .flatten()
- } else {
- None
- };
+ let thumbnail =
+ if media_type != MediaType::Video && content.thumbnail_source().is_some() {
+ client
+ .get_thumbnail(
+ content.clone(),
+ MediaThumbnailSize {
+ method: Method::Scale,
+ width: uint!(320),
+ height: uint!(240),
+ },
+ true,
+ )
+ .await
+ .ok()
+ .flatten()
+ } else {
+ None
+ };
if let Some(data) = thumbnail {
- let id = media_type_uid(content.thumbnail());
+ let id = media_type_uid(content.thumbnail_source());
Ok((Some(data), id))
} else {
- let id = media_type_uid(content.file());
+ let id = media_type_uid(content.source());
client.get_file(content, true).await.map(|data| (data, id))
}
});
diff --git a/src/session/content/room_history/message_row/mod.rs
b/src/session/content/room_history/message_row/mod.rs
index b08d0c112..7152822a3 100644
--- a/src/session/content/room_history/message_row/mod.rs
+++ b/src/session/content/room_history/message_row/mod.rs
@@ -17,7 +17,7 @@ use gtk::{
use log::warn;
use matrix_sdk::ruma::events::{
room::message::{MessageType, Relation},
- AnyMessageEventContent,
+ AnyMessageLikeEventContent,
};
use self::{
@@ -239,7 +239,7 @@ fn build_content(parent: &adw::Bin, event: &Event, compact: bool) {
// TODO: display reaction events from event.relates_to()
// TODO: we should reuse the already present child widgets when possible
match event.content() {
- Some(AnyMessageEventContent::RoomMessage(message)) => {
+ Some(AnyMessageLikeEventContent::RoomMessage(message)) => {
let msgtype = if let Some(Relation::Replacement(replacement)) = message.relates_to {
replacement.new_content.msgtype
} else {
@@ -382,7 +382,7 @@ fn build_content(parent: &adw::Bin, event: &Event, compact: bool) {
}
}
}
- Some(AnyMessageEventContent::Sticker(content)) => {
+ Some(AnyMessageLikeEventContent::Sticker(content)) => {
let child =
if let Some(Ok(child)) = parent.child().map(|w| w.downcast::<MessageMedia>()) {
child
@@ -393,7 +393,7 @@ fn build_content(parent: &adw::Bin, event: &Event, compact: bool) {
};
child.sticker(content, &event.room().session(), compact);
}
- Some(AnyMessageEventContent::RoomEncrypted(content)) => {
+ Some(AnyMessageLikeEventContent::RoomEncrypted(content)) => {
warn!("Couldn't decrypt event {:?}", content);
let child = if let Some(Ok(child)) = parent.child().map(|w| w.downcast::<MessageText>())
{
@@ -405,7 +405,7 @@ fn build_content(parent: &adw::Bin, event: &Event, compact: bool) {
};
child.text(gettext("Fractal couldn't decrypt this message."));
}
- Some(AnyMessageEventContent::RoomRedaction(_)) => {
+ Some(AnyMessageLikeEventContent::RoomRedaction(_)) => {
let child = if let Some(Ok(child)) = parent.child().map(|w| w.downcast::<MessageText>())
{
child
diff --git a/src/session/content/room_history/state_row/mod.rs
b/src/session/content/room_history/state_row/mod.rs
index 8abd12545..e2b3dfcce 100644
--- a/src/session/content/room_history/state_row/mod.rs
+++ b/src/session/content/room_history/state_row/mod.rs
@@ -76,7 +76,7 @@ impl StateRow {
match event.membership {
MembershipState::Join => {
- let message = match state.prev_content() {
+ let message = match state.unsigned().prev_content {
Some(AnyStateEventContent::RoomMember(prev))
if event.membership != prev.membership =>
{
@@ -132,7 +132,7 @@ impl StateRow {
))
}
MembershipState::Leave => {
- let message = match state.prev_content() {
+ let message = match state.unsigned().prev_content {
Some(AnyStateEventContent::RoomMember(prev))
if prev.membership == MembershipState::Invite =>
{
diff --git a/src/session/media_viewer.rs b/src/session/media_viewer.rs
index 1d696e74b..65df94b3c 100644
--- a/src/session/media_viewer.rs
+++ b/src/session/media_viewer.rs
@@ -2,7 +2,7 @@ use adw::{prelude::*, subclass::prelude::*};
use gettextrs::gettext;
use gtk::{gdk, gio, glib, glib::clone, subclass::prelude::*, CompositeTemplate};
use log::warn;
-use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageEventContent};
+use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageLikeEventContent};
use super::room::EventActions;
use crate::{session::room::Event, spawn, utils::cache_dir, Window};
@@ -220,7 +220,8 @@ impl MediaViewer {
fn build(&self) {
if let Some(event) = self.event() {
self.set_event_actions(Some(&event));
- if let Some(AnyMessageEventContent::RoomMessage(content)) = event.message_content() {
+ if let Some(AnyMessageLikeEventContent::RoomMessage(content)) = event.message_content()
+ {
match content.msgtype {
MessageType::Image(image) => {
self.set_body(Some(image.body));
diff --git a/src/session/mod.rs b/src/session/mod.rs
index db515e7e3..9bbee2f77 100644
--- a/src/session/mod.rs
+++ b/src/session/mod.rs
@@ -35,8 +35,7 @@ use matrix_sdk::{
},
error::{FromHttpResponseError, ServerError},
},
- assign,
- identifiers::RoomId,
+ assign, RoomId,
},
store::{make_store_config, OpenStoreError},
Client, ClientBuildError, Error, HttpError,
@@ -698,9 +697,9 @@ impl Session {
}
}
Err(error) => {
- if let matrix_sdk::Error::Http(HttpError::ClientApi(FromHttpResponseError::Http(
- ServerError::Known(ref error),
- ))) = error
+ if let matrix_sdk::Error::Http(HttpError::ClientApi(
+ FromHttpResponseError::Server(ServerError::Known(ref error)),
+ )) = error
{
if let ErrorKind::UnknownToken { soft_logout: _ } = error.kind {
self.handle_logged_out();
diff --git a/src/session/room/event.rs b/src/session/room/event.rs
index 1b8b1ab3e..7de068441 100644
--- a/src/session/room/event.rs
+++ b/src/session/room/event.rs
@@ -12,18 +12,15 @@ use matrix_sdk::{
media::MediaEventContent,
ruma::{
events::{
- room::{
- member::MembershipState,
- message::{MessageType, Relation},
- },
- AnyMessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent,
- Unsigned,
+ room::message::{MessageType, Relation},
+ AnyMessageLikeEventContent, AnySyncMessageLikeEvent, AnySyncRoomEvent,
+ AnySyncStateEvent, MessageLikeUnsigned,
},
- identifiers::{EventId, TransactionId, UserId},
- MilliSecondsSinceUnixEpoch,
+ EventId, MilliSecondsSinceUnixEpoch, TransactionId, UserId,
},
Error as MatrixError,
};
+use ruma::events::room::member::MembershipState;
use crate::{
session::{
@@ -265,9 +262,9 @@ impl Event {
.as_ref()
.unwrap()
.event
- .get_field::<Unsigned>("unsigned")
+ .get_field::<MessageLikeUnsigned>("unsigned")
.ok()
- .and_then(|opt| opt)
+ .flatten()
.and_then(|unsigned| unsigned.transaction_id)
}
@@ -358,11 +355,11 @@ impl Event {
/// Find the related event if any
pub fn related_matrix_event(&self) -> Option<Box<EventId>> {
match self.imp().event.borrow().as_ref()? {
- AnySyncRoomEvent::Message(ref message) => match message {
- AnySyncMessageEvent::RoomRedaction(event) => Some(event.redacts.clone()),
+ AnySyncRoomEvent::MessageLike(ref message) => match message {
+ AnySyncMessageLikeEvent::RoomRedaction(event) => Some(event.redacts.clone()),
_ => match message.content() {
- AnyMessageEventContent::Reaction(event) => Some(event.relates_to.event_id),
- AnyMessageEventContent::RoomMessage(event) => match event.relates_to {
+ AnyMessageLikeEventContent::Reaction(event) => Some(event.relates_to.event_id),
+ AnyMessageLikeEventContent::RoomMessage(event) => match event.relates_to {
Some(relates_to) => match relates_to {
// TODO: Figure out Relation::Annotation(), Relation::Reference() but
// they are pre-specs for now See:
https://github.com/uhoreg/matrix-doc/blob/aggregations-reactions/proposals/2677-reactions.md
@@ -386,8 +383,8 @@ impl Event {
let priv_ = self.imp();
if self.related_matrix_event().is_some() {
- if let Some(AnySyncRoomEvent::Message(message)) = priv_.event.borrow().as_ref() {
- if let AnyMessageEventContent::RoomMessage(content) = message.content() {
+ if let Some(AnySyncRoomEvent::MessageLike(message)) = priv_.event.borrow().as_ref() {
+ if let AnyMessageLikeEventContent::RoomMessage(content) = message.content() {
if let Some(Relation::Reply { in_reply_to: _ }) = content.relates_to {
return false;
}
@@ -400,21 +397,21 @@ impl Event {
// List of all events to be hidden.
match event.as_ref() {
- Some(AnySyncRoomEvent::Message(message)) => matches!(
+ Some(AnySyncRoomEvent::MessageLike(message)) => matches!(
message,
- AnySyncMessageEvent::CallAnswer(_)
- | AnySyncMessageEvent::CallInvite(_)
- | AnySyncMessageEvent::CallHangup(_)
- | AnySyncMessageEvent::CallCandidates(_)
- | AnySyncMessageEvent::KeyVerificationReady(_)
- | AnySyncMessageEvent::KeyVerificationStart(_)
- | AnySyncMessageEvent::KeyVerificationCancel(_)
- | AnySyncMessageEvent::KeyVerificationAccept(_)
- | AnySyncMessageEvent::KeyVerificationKey(_)
- | AnySyncMessageEvent::KeyVerificationMac(_)
- | AnySyncMessageEvent::KeyVerificationDone(_)
- | AnySyncMessageEvent::RoomMessageFeedback(_)
- | AnySyncMessageEvent::RoomRedaction(_)
+ AnySyncMessageLikeEvent::CallAnswer(_)
+ | AnySyncMessageLikeEvent::CallInvite(_)
+ | AnySyncMessageLikeEvent::CallHangup(_)
+ | AnySyncMessageLikeEvent::CallCandidates(_)
+ | AnySyncMessageLikeEvent::KeyVerificationReady(_)
+ | AnySyncMessageLikeEvent::KeyVerificationStart(_)
+ | AnySyncMessageLikeEvent::KeyVerificationCancel(_)
+ | AnySyncMessageLikeEvent::KeyVerificationAccept(_)
+ | AnySyncMessageLikeEvent::KeyVerificationKey(_)
+ | AnySyncMessageLikeEvent::KeyVerificationMac(_)
+ | AnySyncMessageLikeEvent::KeyVerificationDone(_)
+ | AnySyncMessageLikeEvent::RoomMessageFeedback(_)
+ | AnySyncMessageLikeEvent::RoomRedaction(_)
),
Some(AnySyncRoomEvent::State(state)) => matches!(
state,
@@ -434,7 +431,7 @@ impl Event {
| AnySyncStateEvent::SpaceParent(_)
| AnySyncStateEvent::SpaceChild(_)
),
- Some(AnySyncRoomEvent::RedactedMessage(_)) => true,
+ Some(AnySyncRoomEvent::RedactedMessageLike(_)) => true,
Some(AnySyncRoomEvent::RedactedState(_)) => true,
_ => false,
}
@@ -456,16 +453,16 @@ impl Event {
/// The content of this message.
///
/// Returns `None` if this is not a message.
- pub fn message_content(&self) -> Option<AnyMessageEventContent> {
+ pub fn message_content(&self) -> Option<AnyMessageLikeEventContent> {
match self.matrix_event() {
- Some(AnySyncRoomEvent::Message(message)) => Some(message.content()),
+ Some(AnySyncRoomEvent::MessageLike(message)) => Some(message.content()),
_ => None,
}
}
pub fn can_hide_header(&self) -> bool {
match self.message_content() {
- Some(AnyMessageEventContent::RoomMessage(message)) => {
+ Some(AnyMessageLikeEventContent::RoomMessage(message)) => {
matches!(
message.msgtype,
MessageType::Audio(_)
@@ -477,7 +474,7 @@ impl Event {
| MessageType::Video(_)
)
}
- Some(AnyMessageEventContent::Sticker(_)) => true,
+ Some(AnyMessageLikeEventContent::Sticker(_)) => true,
_ => false,
}
}
@@ -490,10 +487,10 @@ impl Event {
/// - `RoomMessage` with `Relation::Replacement`
pub fn is_replacing_event(&self) -> bool {
match self.matrix_event() {
- Some(AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomMessage(message))) => {
+ Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(message))) => {
matches!(message.content.relates_to, Some(Relation::Replacement(_)))
}
- Some(AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomRedaction(_))) => true,
+ Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomRedaction(_))) => true,
_ => false,
}
}
@@ -562,8 +559,8 @@ impl Event {
.filter(|event| {
matches!(
event.matrix_event(),
- Some(AnySyncRoomEvent::Message(
- AnySyncMessageEvent::RoomRedaction(_)
+ Some(AnySyncRoomEvent::MessageLike(
+ AnySyncMessageLikeEvent::RoomRedaction(_)
))
)
})
@@ -574,7 +571,7 @@ impl Event {
pub fn is_reaction(&self) -> bool {
matches!(
self.message_content(),
- Some(AnyMessageEventContent::Reaction(_))
+ Some(AnyMessageLikeEventContent::Reaction(_))
)
}
@@ -591,9 +588,9 @@ impl Event {
}
/// The content of this matrix event.
- pub fn original_content(&self) -> Option<AnyMessageEventContent> {
+ pub fn original_content(&self) -> Option<AnyMessageLikeEventContent> {
match self.matrix_event()? {
- AnySyncRoomEvent::Message(message) => Some(message.content()),
+ AnySyncRoomEvent::MessageLike(message) => Some(message.content()),
_ => None,
}
}
@@ -602,7 +599,7 @@ impl Event {
///
/// If this matrix event has been replaced, returns the replacing `Event`'s
/// content.
- pub fn content(&self) -> Option<AnyMessageEventContent> {
+ pub fn content(&self) -> Option<AnyMessageLikeEventContent> {
self.replacement()
.and_then(|replacement| replacement.content())
.or_else(|| self.original_content())
@@ -627,11 +624,11 @@ impl Event {
/// error occurred while fetching the content. Panics on an incompatible
/// event. `uid` is a unique identifier for this media.
pub async fn get_media_content(&self) -> Result<(String, String, Vec<u8>), matrix_sdk::Error> {
- if let AnyMessageEventContent::RoomMessage(content) = self.message_content().unwrap() {
+ if let AnyMessageLikeEventContent::RoomMessage(content) = self.message_content().unwrap() {
let client = self.room().session().client();
match content.msgtype {
MessageType::File(content) => {
- let uid = media_type_uid(content.file());
+ let uid = media_type_uid(content.source());
let filename = content
.filename
.as_ref()
@@ -653,7 +650,7 @@ impl Event {
return Ok((uid, filename, data));
}
MessageType::Image(content) => {
- let uid = media_type_uid(content.file());
+ let uid = media_type_uid(content.source());
let filename = if content.body.is_empty() {
filename_for_mime(
content
@@ -670,7 +667,7 @@ impl Event {
return Ok((uid, filename, data));
}
MessageType::Video(content) => {
- let uid = media_type_uid(content.file());
+ let uid = media_type_uid(content.source());
let filename = if content.body.is_empty() {
filename_for_mime(
content
@@ -696,7 +693,7 @@ impl Event {
/// Whether this is a media event that can be viewed.
pub fn can_view_media(&self) -> bool {
match self.message_content() {
- Some(AnyMessageEventContent::RoomMessage(message)) => {
+ Some(AnyMessageLikeEventContent::RoomMessage(message)) => {
matches!(
message.msgtype,
MessageType::Image(_) | MessageType::Video(_)
@@ -709,7 +706,7 @@ impl Event {
/// Get the id of the event this `Event` replies to, if any.
pub fn reply_to_id(&self) -> Option<Box<EventId>> {
match self.original_content()? {
- AnyMessageEventContent::RoomMessage(message) => {
+ AnyMessageLikeEventContent::RoomMessage(message) => {
if let Some(Relation::Reply { in_reply_to }) = message.relates_to {
Some(in_reply_to.event_id)
} else {
@@ -749,11 +746,11 @@ impl Event {
/// user joining the room, which should be the oldest possible change.
pub fn can_be_latest_change(&self) -> bool {
if let Some(event) = self.matrix_event() {
- matches!(event, AnySyncRoomEvent::Message(_))
+ matches!(event, AnySyncRoomEvent::MessageLike(_))
|| matches!(event, AnySyncRoomEvent::State(AnySyncStateEvent::RoomMember(event))
if event.state_key == self.room().session().user().unwrap().user_id().to_string()
&& event.content.membership == MembershipState::Join
- && event.prev_content.as_ref()
+ && event.unsigned.prev_content.as_ref()
.filter(|content| content.membership == MembershipState::Join).is_none()
)
} else {
diff --git a/src/session/room/event_actions.rs b/src/session/room/event_actions.rs
index c0105f15c..002d56718 100644
--- a/src/session/room/event_actions.rs
+++ b/src/session/room/event_actions.rs
@@ -1,7 +1,7 @@
use gettextrs::gettext;
use gtk::{gio, glib, glib::clone, prelude::*};
use log::error;
-use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageEventContent};
+use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageLikeEventContent};
use once_cell::sync::Lazy;
use crate::{
@@ -90,7 +90,7 @@ where
})
);
- if let Some(AnyMessageEventContent::RoomMessage(message)) = event.message_content() {
+ if let Some(AnyMessageLikeEventContent::RoomMessage(message)) = event.message_content() {
let user_id = event
.room()
.session()
diff --git a/src/session/room/item.rs b/src/session/room/item.rs
index 37285a607..6851a61e1 100644
--- a/src/session/room/item.rs
+++ b/src/session/room/item.rs
@@ -1,10 +1,7 @@
use std::sync::Arc;
use gtk::{glib, glib::DateTime, prelude::*, subclass::prelude::*};
-use matrix_sdk::ruma::{
- events::AnySyncRoomEvent,
- identifiers::{EventId, UserId},
-};
+use matrix_sdk::ruma::{events::AnySyncRoomEvent, EventId, UserId};
use crate::session::room::Event;
diff --git a/src/session/room/member.rs b/src/session/room/member.rs
index af94b8538..0da9950c1 100644
--- a/src/session/room/member.rs
+++ b/src/session/room/member.rs
@@ -5,7 +5,7 @@ use matrix_sdk::{
room::member::{MembershipState, RoomMemberEventContent},
StrippedStateEvent, SyncStateEvent,
},
- identifiers::{MxcUri, UserId},
+ MxcUri, UserId,
},
RoomMember,
};
diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs
index abfd29a06..a344490d7 100644
--- a/src/session/room/mod.rs
+++ b/src/session/room/mod.rs
@@ -32,11 +32,11 @@ use matrix_sdk::{
},
tag::{TagInfo, TagName},
AnyRoomAccountDataEvent, AnyStateEventContent, AnyStrippedStateEvent, AnySyncRoomEvent,
- AnySyncStateEvent, MessageEventContent, StateEventType, SyncMessageEvent, Unsigned,
+ AnySyncStateEvent, EventContent, MessageLikeEventType, MessageLikeUnsigned,
+ StateEventType, SyncMessageLikeEvent,
},
- identifiers::{EventId, RoomId, UserId},
serde::Raw,
- MilliSecondsSinceUnixEpoch,
+ EventId, MilliSecondsSinceUnixEpoch, RoomId, UserId,
},
};
@@ -910,15 +910,18 @@ impl Room {
}
/// Send a message with the given `content` in this room.
- pub fn send_room_message_event(&self, content: impl MessageEventContent + Send + 'static) {
+ pub fn send_room_message_event(
+ &self,
+ content: impl EventContent<EventType = MessageLikeEventType> + Send + 'static,
+ ) {
if let MatrixRoom::Joined(matrix_room) = self.matrix_room() {
let (txn_id, event_id) = pending_event_ids();
- let matrix_event = SyncMessageEvent {
+ let matrix_event = SyncMessageLikeEvent {
content,
event_id,
sender: self.session().user().unwrap().user_id().as_ref().to_owned(),
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
- unsigned: Unsigned::default(),
+ unsigned: MessageLikeUnsigned::default(),
};
let raw_event: Raw<AnySyncRoomEvent> = Raw::new(&matrix_event).unwrap().cast();
@@ -966,7 +969,7 @@ impl Room {
event_id,
sender: self.session().user().unwrap().user_id().as_ref().to_owned(),
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
- unsigned: Unsigned::default(),
+ unsigned: MessageLikeUnsigned::default(),
};
if let MatrixRoom::Joined(matrix_room) = self.matrix_room() {
diff --git a/src/session/room/power_levels.rs b/src/session/room/power_levels.rs
index 684e1e85b..9923493ed 100644
--- a/src/session/room/power_levels.rs
+++ b/src/session/room/power_levels.rs
@@ -1,6 +1,6 @@
use gtk::{glib, glib::closure, prelude::*, subclass::prelude::*};
use matrix_sdk::ruma::events::{
- room::power_levels::RoomPowerLevelsEventContent, EventType, SyncStateEvent,
+ room::power_levels::RoomPowerLevelsEventContent, RoomEventType, SyncStateEvent,
};
use crate::session::room::Member;
@@ -128,7 +128,7 @@ fn min_level_for_room_action(
.events
.get(event_type)
.unwrap_or(&content.state_default),
- RoomAction::MessageEvent(event_type) => *content
+ RoomAction::MessageLikeEvent(event_type) => *content
.events
.get(event_type)
.unwrap_or(&content.events_default),
@@ -143,6 +143,6 @@ pub enum RoomAction {
Kick,
Redact,
RoomNotification,
- StateEvent(EventType),
- MessageEvent(EventType),
+ StateEvent(RoomEventType),
+ MessageLikeEvent(RoomEventType),
}
diff --git a/src/session/room/reaction_list.rs b/src/session/room/reaction_list.rs
index 7968ced97..9cc9b74ce 100644
--- a/src/session/room/reaction_list.rs
+++ b/src/session/room/reaction_list.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
-use matrix_sdk::ruma::events::AnyMessageEventContent;
+use matrix_sdk::ruma::events::AnyMessageLikeEventContent;
use super::{Event, ReactionGroup};
@@ -68,10 +68,10 @@ impl ReactionList {
// Group reactions by key
let mut grouped_reactions: HashMap<String, Vec<Event>> = HashMap::new();
for event in new_reactions {
- if let Some(AnyMessageEventContent::Reaction(reaction)) = event.message_content() {
+ if let Some(AnyMessageLikeEventContent::Reaction(reaction)) = event.message_content() {
let relation = reaction.relates_to;
grouped_reactions
- .entry(relation.emoji)
+ .entry(relation.key)
.or_default()
.push(event);
}
diff --git a/src/session/room/timeline.rs b/src/session/room/timeline.rs
index afbdee032..8569086a9 100644
--- a/src/session/room/timeline.rs
+++ b/src/session/room/timeline.rs
@@ -10,8 +10,8 @@ use log::{error, warn};
use matrix_sdk::{
deserialized_responses::SyncRoomEvent,
ruma::{
- events::{room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent},
- identifiers::{EventId, TransactionId},
+ events::{room::message::MessageType, AnySyncMessageLikeEvent, AnySyncRoomEvent},
+ EventId, TransactionId,
},
Error as MatrixError,
};
@@ -846,7 +846,7 @@ impl Timeline {
}
fn handle_verification(&self, event: &Event) {
- let message = if let Some(AnySyncRoomEvent::Message(message)) = event.matrix_event() {
+ let message = if let Some(AnySyncRoomEvent::MessageLike(message)) = event.matrix_event() {
message
} else {
return;
@@ -856,7 +856,7 @@ impl Timeline {
let verification_list = session.verification_list();
let request = match message {
- AnySyncMessageEvent::RoomMessage(message) => {
+ AnySyncMessageLikeEvent::RoomMessage(message) => {
if let MessageType::VerificationRequest(request) = message.content.msgtype {
// Ignore request that are too old
if let Some(time) = message.origin_server_ts.to_system_time() {
@@ -914,25 +914,25 @@ impl Timeline {
return;
}
- AnySyncMessageEvent::KeyVerificationReady(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationReady(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationStart(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationStart(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationCancel(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationCancel(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationAccept(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationAccept(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationKey(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationKey(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationMac(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationMac(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageEvent::KeyVerificationDone(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationDone(e) => {
verification_list.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
_ => {
diff --git a/src/session/room_creation/mod.rs b/src/session/room_creation/mod.rs
index 2f84b7fb4..973c23c9b 100644
--- a/src/session/room_creation/mod.rs
+++ b/src/session/room_creation/mod.rs
@@ -14,7 +14,8 @@ use matrix_sdk::{
error::{FromHttpResponseError, ServerError},
},
assign,
- identifiers::{Error, RoomName},
+ common::RoomName,
+ IdParseError,
},
HttpError,
};
@@ -266,7 +267,7 @@ impl RoomCreation {
priv_.cancel_button.set_sensitive(true);
// Treat the room address already taken error special
- if let HttpError::ClientApi(FromHttpResponseError::Http(ServerError::Known(
+ if let HttpError::ClientApi(FromHttpResponseError::Server(ServerError::Known(
ref client_error,
))) = error
{
@@ -293,8 +294,8 @@ impl RoomCreation {
let (is_name_valid, has_error) =
match <&RoomName>::try_from(priv_.room_name.text().as_str()) {
Ok(_) => (true, false),
- Err(Error::EmptyRoomName) => (false, false),
- Err(Error::MaximumLengthExceeded) => {
+ Err(IdParseError::EmptyRoomName) => (false, false),
+ Err(IdParseError::MaximumLengthExceeded) => {
priv_
.room_name_error
.set_text(&gettext("Too long. Use a shorter name."));
diff --git a/src/session/room_list.rs b/src/session/room_list.rs
index 7c7c29b34..256938cac 100644
--- a/src/session/room_list.rs
+++ b/src/session/room_list.rs
@@ -6,7 +6,7 @@ use indexmap::map::IndexMap;
use log::error;
use matrix_sdk::{
deserialized_responses::Rooms as ResponseRooms,
- ruma::identifiers::{RoomId, RoomOrAliasId},
+ ruma::{RoomId, RoomOrAliasId},
};
use crate::{
diff --git a/src/session/user.rs b/src/session/user.rs
index 442a13ccf..b87c7ae2e 100644
--- a/src/session/user.rs
+++ b/src/session/user.rs
@@ -4,7 +4,7 @@ use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
use log::error;
use matrix_sdk::{
encryption::identities::UserIdentity,
- ruma::identifiers::{MxcUri, UserId},
+ ruma::{MxcUri, UserId},
};
use crate::{
diff --git a/src/session/verification/identity_verification.rs
b/src/session/verification/identity_verification.rs
index f3c06cb4f..9b5ba0926 100644
--- a/src/session/verification/identity_verification.rs
+++ b/src/session/verification/identity_verification.rs
@@ -13,7 +13,7 @@ use matrix_sdk::{
},
ruma::{
events::key::verification::{cancel::CancelCode, VerificationMethod},
- identifiers::UserId,
+ UserId,
},
Client,
};
@@ -132,7 +132,7 @@ pub enum UserAction {
NotMatch,
Cancel,
StartSas,
- Scanned(QrVerificationData),
+ Scanned(Box<QrVerificationData>),
ConfirmScanning,
}
@@ -745,7 +745,8 @@ impl IdentityVerification {
pub fn scanned_qr_code(&self, data: QrVerificationData) {
if let Some(sync_sender) = &*self.imp().sync_sender.borrow() {
- let result = sync_sender.try_send(Message::UserAction(UserAction::Scanned(data)));
+ let result =
+ sync_sender.try_send(Message::UserAction(UserAction::Scanned(Box::new(data))));
if let Err(error) = result {
error!("Failed to send message to tokio runtime: {}", error);
@@ -1058,11 +1059,11 @@ impl Context {
async fn finish_scanning(
mut self,
- data: QrVerificationData,
+ data: Box<QrVerificationData>,
) -> Result<State, RequestVerificationError> {
let request = self
.request
- .scan_qr_code(data)
+ .scan_qr_code(*data)
.await?
.expect("Scanning Qr Code should be supported");
diff --git a/src/session/verification/verification_list.rs b/src/session/verification/verification_list.rs
index cdd234c33..1ca224547 100644
--- a/src/session/verification/verification_list.rs
+++ b/src/session/verification/verification_list.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use log::{debug, warn};
use matrix_sdk::ruma::{
- api::client::sync::sync_events::v3::ToDevice, events::AnyToDeviceEvent, identifiers::UserId,
+ api::client::sync::sync_events::v3::ToDevice, events::AnyToDeviceEvent, UserId,
};
use crate::session::{
diff --git a/src/user_facing_error.rs b/src/user_facing_error.rs
index 5728996ac..9076fc229 100644
--- a/src/user_facing_error.rs
+++ b/src/user_facing_error.rs
@@ -23,7 +23,7 @@ impl UserFacingError for HttpError {
gettext("Unable to connect to the homeserver.")
}
}
- HttpError::ClientApi(FromHttpResponseError::Http(ServerError::Known(error))) => {
+ HttpError::ClientApi(FromHttpResponseError::Server(ServerError::Known(error))) => {
match error.kind {
Forbidden => gettext("The provided username or password is invalid."),
UserDeactivated => gettext("The user is deactivated."),
diff --git a/src/utils.rs b/src/utils.rs
index 96128a6e7..8e9bedd4e 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -18,7 +18,7 @@ macro_rules! fn_event {
macro_rules! event_from_sync_event {
( $event:ident, $room_id:ident) => {
match $event {
- AnySyncRoomEvent::Message(event) => {
+ AnySyncRoomEvent::MessageLike(event) => {
AnyRoomEvent::Message(event.into_full_event($room_id.clone()))
}
AnySyncRoomEvent::State(event) => {
@@ -67,10 +67,7 @@ use gtk::{
gio::{self, prelude::*},
glib::{self, closure, Object},
};
-use matrix_sdk::{
- media::MediaType,
- ruma::{EventId, TransactionId, UInt},
-};
+use matrix_sdk::ruma::{events::room::MediaSource, EventId, TransactionId, UInt};
use mime::Mime;
// Returns an expression that is the and’ed result of the given boolean
@@ -151,17 +148,17 @@ pub fn style_scheme() -> Option<sourceview::StyleScheme> {
sourceview::StyleSchemeManager::default().scheme(scheme_name)
}
-/// Get the unique id of the given `MediaType`.
+/// Get the unique id of the given `MediaSource`.
///
/// It is built from the underlying `MxcUri` and can be safely used in a
/// filename.
///
/// The id is not guaranteed to be unique for malformed `MxcUri`s.
-pub fn media_type_uid(media_type: Option<MediaType>) -> String {
+pub fn media_type_uid(media_type: Option<MediaSource>) -> String {
if let Some(mxc) = media_type
.map(|media_type| match media_type {
- MediaType::Uri(uri) => uri,
- MediaType::Encrypted(file) => file.url,
+ MediaSource::Plain(uri) => uri,
+ MediaSource::Encrypted(file) => file.url,
})
.filter(|mxc| mxc.is_valid())
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]