[fractal] chore: Update matrix-sdk
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] chore: Update matrix-sdk
- Date: Mon, 9 May 2022 17:01:50 +0000 (UTC)
commit d740fd4f1141db2707bd3f0eeac4b4bde3b62c94
Author: Kévin Commaille <zecakeh tedomum fr>
Date: Sat May 7 16:39:18 2022 +0200
chore: Update matrix-sdk
.cargo/config.toml | 2 +
Cargo.lock | 341 +++++++++++++--------
Cargo.toml | 12 +-
build-aux/org.gnome.Fractal.Hack.json | 6 +-
src/login/mod.rs | 4 +-
src/secret.rs | 6 +-
.../user_page/change_password_subpage.rs | 12 +-
src/session/account_settings/user_page/mod.rs | 4 +-
src/session/avatar.rs | 21 +-
.../room_details/invite_subpage/invitee_list.rs | 10 +-
src/session/content/room_history/item_row.rs | 2 +-
src/session/content/room_history/state_row/mod.rs | 77 ++---
src/session/media_viewer.rs | 3 +-
src/session/mod.rs | 8 +-
src/session/room/event.rs | 143 ++++-----
src/session/room/event_actions.rs | 2 +-
src/session/room/member.rs | 8 +-
src/session/room/member_list.rs | 23 +-
src/session/room/mod.rs | 112 ++++---
src/session/room/power_levels.rs | 4 +-
src/session/room/reaction_list.rs | 2 +-
src/session/room/timeline/mod.rs | 19 +-
src/session/room_creation/mod.rs | 22 +-
src/session/room_list.rs | 14 +-
src/session/user.rs | 12 +-
src/session/verification/verification_list.rs | 37 ++-
src/user_facing_error.rs | 6 +-
src/utils.rs | 6 +-
28 files changed, 495 insertions(+), 423 deletions(-)
---
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 000000000..64d439663
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,2 @@
+[build]
+rustflags = ["--cfg", "ruma_identifiers_storage=\"Arc\""]
diff --git a/Cargo.lock b/Cargo.lock
index 9a2bc6c4b..e286caf8a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -33,7 +33,6 @@ dependencies = [
"cfg-if 1.0.0",
"cipher 0.3.0",
"cpufeatures",
- "ctr",
"opaque-debug",
]
@@ -57,7 +56,7 @@ dependencies = [
"aead",
"aes 0.7.5",
"cipher 0.3.0",
- "ctr",
+ "ctr 0.8.0",
"ghash",
"subtle",
]
@@ -68,7 +67,7 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.5",
+ "getrandom 0.2.6",
"once_cell",
"version_check",
]
@@ -107,9 +106,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.55"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
+checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"
[[package]]
name = "anymap2"
@@ -228,6 +227,12 @@ dependencies = [
"event-listener",
]
+[[package]]
+name = "async-once-cell"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e52116ee51c72c07a9db74c6f95213c95c462408bb5a689772d623a62b96471"
+
[[package]]
name = "async-recursion"
version = "0.3.2"
@@ -241,9 +246,9 @@ dependencies = [
[[package]]
name = "async-stream"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625"
+checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e"
dependencies = [
"async-stream-impl",
"futures-core",
@@ -251,9 +256,9 @@ dependencies = [
[[package]]
name = "async-stream-impl"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
+checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
@@ -268,9 +273,9 @@ checksum = "677d306121baf53310a3fd342d88dc0824f6bbeace68347593658525565abee8"
[[package]]
name = "async-trait"
-version = "0.1.52"
+version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
+checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
@@ -310,7 +315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
dependencies = [
"futures-core",
- "getrandom 0.2.5",
+ "getrandom 0.2.6",
"instant",
"pin-project-lite",
"rand 0.8.5",
@@ -688,9 +693,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
-version = "0.5.2"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
+checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@@ -749,6 +754,15 @@ dependencies = [
"cipher 0.3.0",
]
+[[package]]
+name = "ctr"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d14f329cfbaf5d0e06b5e87fff7e265d2673c5ea7d2c27691a2c107db1442a0"
+dependencies = [
+ "cipher 0.4.3",
+]
+
[[package]]
name = "curve25519-dalek"
version = "3.2.0"
@@ -765,9 +779,9 @@ dependencies = [
[[package]]
name = "dashmap"
-version = "5.1.0"
+version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c"
+checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c"
dependencies = [
"cfg-if 1.0.0",
"num_cpus",
@@ -1159,16 +1173,6 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
-[[package]]
-name = "futures-timer"
-version = "3.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
-dependencies = [
- "gloo-timers",
- "send_wrapper",
-]
-
[[package]]
name = "futures-util"
version = "0.3.21"
@@ -1357,9 +1361,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
+checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
@@ -1489,18 +1493,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-[[package]]
-name = "gloo-timers"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e"
-dependencies = [
- "futures-channel",
- "futures-core",
- "js-sys",
- "wasm-bindgen",
-]
-
[[package]]
name = "gobject-sys"
version = "0.15.5"
@@ -2014,6 +2006,20 @@ dependencies = [
"tiff",
]
+[[package]]
+name = "indexed_db_futures"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d26ac735f676c52305becf53264b91cea9866a8de61ccbf464405b377b9cbca9"
+dependencies = [
+ "cfg-if 1.0.0",
+ "js-sys",
+ "uuid 0.8.2",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
[[package]]
name = "indexmap"
version = "1.8.0"
@@ -2088,9 +2094,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.56"
+version = "0.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
+checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397"
dependencies = [
"wasm-bindgen",
]
@@ -2104,6 +2110,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "js_option"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57ca36dc34f183b719922d262d2d144a1e6a5573cdfaec30587c2dc64ea685a6"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -2163,9 +2178,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.119"
+version = "0.2.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
+checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
[[package]]
name = "libloading"
@@ -2312,9 +2327,9 @@ dependencies = [
[[package]]
name = "lru"
-version = "0.7.3"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcb87f3080f6d1d69e8c564c0fcfde1d7aa8cc451ce40cae89479111f03bc0eb"
+checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889"
dependencies = [
"hashbrown",
]
@@ -2375,7 +2390,7 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "matrix-qrcode"
version = "0.2.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"base64",
"byteorder",
@@ -2390,20 +2405,22 @@ dependencies = [
[[package]]
name = "matrix-sdk"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"anymap2",
+ "async-once-cell",
"async-stream",
+ "async-trait",
"backoff",
"bytes",
"dashmap",
"event-listener",
"futures-core",
- "futures-timer",
"futures-util",
"http",
"matrix-sdk-base",
"matrix-sdk-common",
+ "matrix-sdk-indexeddb",
"matrix-sdk-sled",
"mime",
"rand 0.8.5",
@@ -2417,31 +2434,28 @@ dependencies = [
"tracing",
"url",
"warp",
+ "wasm-timer",
"zeroize",
]
[[package]]
name = "matrix-sdk-base"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"anyhow",
"async-stream",
- "chacha20poly1305",
+ "async-trait",
"dashmap",
"futures-channel",
"futures-core",
"futures-util",
- "hmac",
- "lru 0.7.3",
+ "lru 0.7.5",
"matrix-sdk-common",
"matrix-sdk-crypto",
- "pbkdf2",
- "rand 0.8.5",
"ruma",
"serde",
"serde_json",
- "sha2 0.10.2",
"thiserror",
"tracing",
"zeroize",
@@ -2450,30 +2464,30 @@ dependencies = [
[[package]]
name = "matrix-sdk-common"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"async-lock",
- "async-trait",
"futures-util",
"instant",
"ruma",
"serde",
"tokio",
- "uuid",
"wasm-bindgen-futures",
]
[[package]]
name = "matrix-sdk-crypto"
version = "0.4.1"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
- "aes 0.7.5",
+ "aes 0.8.1",
"aes-gcm",
"anyhow",
+ "async-trait",
"atomic",
"base64",
"byteorder",
+ "ctr 0.9.1",
"dashmap",
"futures-util",
"hmac",
@@ -2491,13 +2505,38 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "matrix-sdk-indexeddb"
+version = "0.1.0"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "base64",
+ "dashmap",
+ "futures-util",
+ "getrandom 0.2.6",
+ "indexed_db_futures",
+ "matrix-sdk-base",
+ "matrix-sdk-crypto",
+ "matrix-sdk-store-encryption",
+ "ruma",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "tracing",
+ "wasm-bindgen",
+ "web-sys",
+]
+
[[package]]
name = "matrix-sdk-sled"
version = "0.1.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"anyhow",
"async-stream",
+ "async-trait",
"dashmap",
"futures-core",
"futures-util",
@@ -2505,6 +2544,7 @@ dependencies = [
"matrix-sdk-common",
"matrix-sdk-crypto",
"matrix-sdk-store-encryption",
+ "ruma",
"serde",
"serde_json",
"sled",
@@ -2516,7 +2556,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-store-encryption"
version = "0.1.0"
-source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#7e48034cc8df1b44bc98e8ece5603e0c386f0186"
+source = "git+https://github.com/matrix-org/matrix-rust-sdk.git#8b805f9f01643c8afd7c92079c1e6cd361cffd05"
dependencies = [
"blake3",
"chacha20poly1305",
@@ -2955,9 +2995,9 @@ dependencies = [
[[package]]
name = "password-hash"
-version = "0.3.2"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
+checksum = "e029e94abc8fb0065241c308f1ac6bc8d20f450e8f7c5f0b25cd9b8d526ba294"
dependencies = [
"base64ct",
"rand_core 0.6.3",
@@ -2972,9 +3012,9 @@ checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5"
[[package]]
name = "pbkdf2"
-version = "0.10.1"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7"
+checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest 0.10.3",
"hmac",
@@ -3281,9 +3321,9 @@ dependencies = [
[[package]]
name = "pulldown-cmark"
-version = "0.8.0"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8"
+checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6"
dependencies = [
"bitflags",
"memchr",
@@ -3384,7 +3424,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
- "getrandom 0.2.5",
+ "getrandom 0.2.6",
]
[[package]]
@@ -3407,9 +3447,9 @@ dependencies = [
[[package]]
name = "rayon"
-version = "1.5.1"
+version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
+checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221"
dependencies = [
"autocfg",
"crossbeam-deque",
@@ -3419,14 +3459,13 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.9.1"
+version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
+checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
- "lazy_static",
"num_cpus",
]
@@ -3467,9 +3506,9 @@ dependencies = [
[[package]]
name = "reqwest"
-version = "0.11.9"
+version = "0.11.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525"
+checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb"
dependencies = [
"base64",
"bytes",
@@ -3515,22 +3554,25 @@ dependencies = [
[[package]]
name = "ruma"
-version = "0.5.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c1c10bece8829acee6f52c7cc5ab40cd9d213b26425a9d3e96ed61d1f5a75c7"
dependencies = [
"assign",
"js_int",
"ruma-client-api",
"ruma-common",
"ruma-federation-api",
+ "ruma-push-gateway-api",
"ruma-signatures",
"ruma-state-res",
]
[[package]]
name = "ruma-client-api"
-version = "0.13.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16f463c15e126f5fd95ce0fc503c1b55412cfebccf8f1ae72d688dc2b0d5330f"
dependencies = [
"assign",
"bytes",
@@ -3545,17 +3587,21 @@ dependencies = [
[[package]]
name = "ruma-common"
-version = "0.8.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "998d74605599fb66296e71cca0921368eb3b13d9ed9704f7a19cdd2f21f6fa11"
dependencies = [
"base64",
"bytes",
"form_urlencoded",
+ "getrandom 0.2.6",
"http",
"indexmap",
"indoc",
"itoa",
+ "js-sys",
"js_int",
+ "js_option",
"percent-encoding",
"pulldown-cmark",
"rand 0.8.5",
@@ -3566,14 +3612,15 @@ dependencies = [
"thiserror",
"tracing",
"url",
- "uuid",
+ "uuid 1.0.0",
"wildmatch",
]
[[package]]
name = "ruma-federation-api"
-version = "0.4.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa53fa447e3ef04889f3f804d49a27045da79e8055f6fd4257c21be6f65edca"
dependencies = [
"js_int",
"ruma-common",
@@ -3583,17 +3630,18 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
-version = "0.7.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74c3b1d01b5ddd8746f25d5971bc1cac5d7f1f455de839a2f817b9e04953a139"
dependencies = [
"thiserror",
- "url",
]
[[package]]
name = "ruma-macros"
-version = "0.1.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e81d73b503ad9779dbfa1ea7cdeea6069094306ca449f4e37028534117cc3a44"
dependencies = [
"proc-macro-crate",
"proc-macro2 1.0.36",
@@ -3602,10 +3650,23 @@ dependencies = [
"syn 1.0.86",
]
+[[package]]
+name = "ruma-push-gateway-api"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78bf16484e0d6dbb88a319e46af1c1bd2702001162c5ee5d2b20a789f1667a7b"
+dependencies = [
+ "js_int",
+ "ruma-common",
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "ruma-signatures"
-version = "0.10.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c747652a4f8c5fd83a703f183c73738b2ed8565a740636c045e064ae77f9b51"
dependencies = [
"base64",
"ed25519-dalek",
@@ -3620,8 +3681,9 @@ dependencies = [
[[package]]
name = "ruma-state-res"
-version = "0.6.0"
-source = "git+https://github.com/ruma/ruma.git?rev=deea762b8#deea762b8edc5abf9fc5fe3cf6daba8cb59ced75"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9b742ca53b37ec3b3cfba1f27bf64be775550aeadf971deb05e4b93cdd27fbe"
dependencies = [
"itertools",
"js_int",
@@ -3722,12 +3784,6 @@ dependencies = [
"pest",
]
-[[package]]
-name = "send_wrapper"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
-
[[package]]
name = "serde"
version = "1.0.136"
@@ -4297,9 +4353,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]]
name = "tracing"
-version = "0.1.31"
+version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f"
+checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
dependencies = [
"cfg-if 1.0.0",
"log",
@@ -4310,9 +4366,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.19"
+version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716"
+checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
@@ -4321,9 +4377,9 @@ dependencies = [
[[package]]
name = "tracing-core"
-version = "0.1.22"
+version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23"
+checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
dependencies = [
"lazy_static",
"valuable",
@@ -4342,9 +4398,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.9"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce"
+checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
dependencies = [
"ansi_term",
"sharded-slab",
@@ -4460,8 +4516,16 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
- "getrandom 0.2.5",
- "serde",
+ "getrandom 0.2.6",
+]
+
+[[package]]
+name = "uuid"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0"
+dependencies = [
+ "getrandom 0.2.6",
]
[[package]]
@@ -4503,7 +4567,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vodozemac"
version = "0.1.0"
-source =
"git+https://github.com/matrix-org/vodozemac?rev=16fb254aa3325c61ef949314c81c35f91d0664e1#16fb254aa3325c61ef949314c81c35f91d0664e1"
+source =
"git+https://github.com/matrix-org/vodozemac?rev=e09c93f2c8df9770793abeec57ed984d5e1f3834#e09c93f2c8df9770793abeec57ed984d5e1f3834"
dependencies = [
"aes 0.8.1",
"arrayvec 0.7.2",
@@ -4587,19 +4651,21 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
-version = "0.2.79"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
+checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
dependencies = [
"cfg-if 1.0.0",
+ "serde",
+ "serde_json",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.79"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
+checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4"
dependencies = [
"bumpalo",
"lazy_static",
@@ -4612,9 +4678,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.29"
+version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395"
+checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
@@ -4624,9 +4690,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.79"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
+checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5"
dependencies = [
"quote 1.0.15",
"wasm-bindgen-macro-support",
@@ -4634,9 +4700,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.79"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
+checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
@@ -4647,15 +4713,30 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.79"
+version = "0.2.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
+
+[[package]]
+name = "wasm-timer"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
+checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
+dependencies = [
+ "futures",
+ "js-sys",
+ "parking_lot 0.11.2",
+ "pin-utils",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
[[package]]
name = "web-sys"
-version = "0.3.56"
+version = "0.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
+checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -4663,9 +4744,9 @@ dependencies = [
[[package]]
name = "weezl"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e"
+checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4"
[[package]]
name = "wepoll-ffi"
@@ -4769,9 +4850,9 @@ checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316"
[[package]]
name = "winreg"
-version = "0.7.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
+checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
diff --git a/Cargo.toml b/Cargo.toml
index adc5397a6..ec0294c77 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,16 +69,8 @@ version = "0.1.0-alpha.4"
[dependencies.matrix-sdk]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
-features = [
- "socks",
- "encryption",
- "sled_cryptostore",
- "sled_state_store",
- "sso_login",
- "markdown",
-]
+features = ["socks", "sso-login", "markdown", "qrcode", "experimental-timeline"]
[dependencies.ruma]
-git = "https://github.com/ruma/ruma.git"
-rev = "deea762b8"
+version = "0.6.1"
features = ["unstable-pre-spec", "client-api-c"]
diff --git a/build-aux/org.gnome.Fractal.Hack.json b/build-aux/org.gnome.Fractal.Hack.json
index 13733ee21..bf215f47f 100644
--- a/build-aux/org.gnome.Fractal.Hack.json
+++ b/build-aux/org.gnome.Fractal.Hack.json
@@ -24,9 +24,9 @@
"append-path": "/usr/lib/sdk/llvm12/bin:/usr/lib/sdk/rust-stable/bin",
"env": {
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": "clang",
- "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C
link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold",
+ "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C
link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold --cfg=ruma_identifiers_storage=\"Arc\"",
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "clang",
- "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C
link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold"
+ "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C
link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold --cfg=ruma_identifiers_storage=\"Arc\""
},
"build-args": [
"--share=network"
@@ -68,4 +68,4 @@
]
}
]
-}
+}
\ No newline at end of file
diff --git a/src/login/mod.rs b/src/login/mod.rs
index 1c179969e..5ec3a5c04 100644
--- a/src/login/mod.rs
+++ b/src/login/mod.rs
@@ -9,7 +9,7 @@ use matrix_sdk::{
LoginType::{Password, Sso},
SsoLoginType,
},
- IdParseError, ServerName,
+ IdParseError, OwnedServerName, ServerName,
},
Client,
};
@@ -641,7 +641,7 @@ impl Default for Login {
}
}
-fn build_server_name(server: &str) -> Result<Box<ServerName>, IdParseError> {
+fn build_server_name(server: &str) -> Result<OwnedServerName, IdParseError> {
let server = server
.strip_prefix("http://")
.or_else(|| server.strip_prefix("https://"))
diff --git a/src/secret.rs b/src/secret.rs
index 97db546f4..89fdfe3af 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::{DeviceId, UserId};
+use matrix_sdk::ruma::{DeviceId, OwnedDeviceId, OwnedUserId, UserId};
use serde::{Deserialize, Serialize};
use serde_json::error::Error as JsonError;
use url::Url;
@@ -65,8 +65,8 @@ impl fmt::Display for SecretError {
#[derive(Debug, Clone)]
pub struct StoredSession {
pub homeserver: Url,
- pub user_id: Box<UserId>,
- pub device_id: Box<DeviceId>,
+ pub user_id: OwnedUserId,
+ pub device_id: OwnedDeviceId,
pub path: PathBuf,
pub secret: Secret,
}
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 7b0d5feaf..5008d7a59 100644
--- a/src/session/account_settings/user_page/change_password_subpage.rs
+++ b/src/session/account_settings/user_page/change_password_subpage.rs
@@ -9,12 +9,12 @@ use log::error;
use matrix_sdk::{
ruma::{
api::{
- client::account::change_password,
+ client::{account::change_password, error::ErrorKind},
error::{FromHttpResponseError, ServerError},
},
assign,
},
- Error as MatrixError, HttpError,
+ Error as MatrixError, HttpError, RumaApiError,
};
use crate::{
@@ -319,9 +319,11 @@ impl ChangePasswordSubpage {
Err(err) => match err {
AuthError::UserCancelled => {}
AuthError::ServerResponse(error)
- if matches!(error.as_ref(), MatrixError::Http(HttpError::ClientApi(
- FromHttpResponseError::Server(ServerError::Known(error)),
- )) if error.kind.as_ref() == "M_WEAK_PASSWORD") =>
+ if matches!(error.as_ref(), MatrixError::Http(HttpError::Api(
+ FromHttpResponseError::Server(ServerError::Known(RumaApiError::ClientApi(
+ error,
+ ))),
+ )) if error.kind == ErrorKind::WeakPassword) =>
{
error!("Weak password: {:?}", error);
let _ = self.activate_action(
diff --git a/src/session/account_settings/user_page/mod.rs b/src/session/account_settings/user_page/mod.rs
index 13b80c09c..ef2c04b39 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::discovery::get_capabilities, MxcUri};
+use matrix_sdk::ruma::{api::client::discovery::get_capabilities, MxcUri, OwnedMxcUri};
mod change_password_subpage;
mod deactivate_account_subpage;
@@ -51,7 +51,7 @@ mod imp {
pub session_id: TemplateChild<gtk::Label>,
#[template_child]
pub deactivate_account_subpage: TemplateChild<DeactivateAccountSubpage>,
- pub changing_avatar_to: RefCell<Option<Box<MxcUri>>>,
+ pub changing_avatar_to: RefCell<Option<OwnedMxcUri>>,
pub removing_avatar: Cell<bool>,
pub changing_display_name_to: RefCell<Option<String>>,
}
diff --git a/src/session/avatar.rs b/src/session/avatar.rs
index 89810cb65..dd1e504ae 100644
--- a/src/session/avatar.rs
+++ b/src/session/avatar.rs
@@ -7,11 +7,8 @@ use matrix_sdk::{
room::Room as MatrixRoom,
ruma::{
api::client::media::get_content_thumbnail::v3::Method,
- events::{
- room::{avatar::RoomAvatarEventContent, MediaSource},
- AnyStateEventContent,
- },
- MxcUri,
+ events::room::{avatar::RoomAvatarEventContent, MediaSource},
+ MxcUri, OwnedMxcUri,
},
Client,
};
@@ -30,7 +27,7 @@ mod imp {
pub struct Avatar {
pub image: RefCell<Option<gdk::Paintable>>,
pub needed_size: Cell<u32>,
- pub url: RefCell<Option<Box<MxcUri>>>,
+ pub url: RefCell<Option<OwnedMxcUri>>,
pub display_name: RefCell<Option<String>>,
pub session: OnceCell<WeakRef<Session>>,
}
@@ -222,7 +219,7 @@ impl Avatar {
self.imp().needed_size.get()
}
- pub fn set_url(&self, url: Option<Box<MxcUri>>) {
+ pub fn set_url(&self, url: Option<OwnedMxcUri>) {
let priv_ = self.imp();
if priv_.url.borrow().as_ref() == url.as_ref() {
@@ -241,7 +238,7 @@ impl Avatar {
self.notify("url");
}
- pub fn url(&self) -> Option<Box<MxcUri>> {
+ pub fn url(&self) -> Option<OwnedMxcUri> {
self.imp().url.borrow().to_owned()
}
}
@@ -253,7 +250,7 @@ pub async fn update_room_avatar_from_file<P>(
matrix_client: &Client,
matrix_room: &MatrixRoom,
filename: Option<&P>,
-) -> Result<Option<Box<MxcUri>>, AvatarError>
+) -> Result<Option<OwnedMxcUri>, AvatarError>
where
P: AsRef<Path> + std::fmt::Debug,
{
@@ -272,14 +269,12 @@ where
};
content.url = uri.clone();
- joined_room
- .send_state_event(AnyStateEventContent::RoomAvatar(content), "")
- .await?;
+ joined_room.send_state_event(content, "").await?;
Ok(uri)
}
/// Returns the URI of the room avatar after uploading it.
-async fn upload_avatar<P>(matrix_client: &Client, filename: &P) -> Result<Box<MxcUri>, AvatarError>
+async fn upload_avatar<P>(matrix_client: &Client, filename: &P) -> Result<OwnedMxcUri, AvatarError>
where
P: AsRef<Path> + std::fmt::Debug,
{
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 59bedac0d..a71e2ac9b 100644
--- a/src/session/content/room_details/invite_subpage/invitee_list.rs
+++ b/src/session/content/room_details/invite_subpage/invitee_list.rs
@@ -1,9 +1,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, UserId},
+ ruma::{api::client::user_directory::search_users, OwnedUserId, UserId},
HttpError,
};
@@ -48,7 +46,7 @@ mod imp {
pub room: OnceCell<Room>,
pub state: Cell<InviteeListState>,
pub search_term: RefCell<Option<String>>,
- pub invitee_list: RefCell<HashMap<Arc<UserId>, Invitee>>,
+ pub invitee_list: RefCell<HashMap<OwnedUserId, Invitee>>,
pub abort_handle: RefCell<Option<AbortHandle>>,
}
@@ -247,7 +245,7 @@ impl InviteeList {
.filter_map(|item| {
// Skip over users that are already in the room
if member_list.contains(&item.user_id) {
- self.remove_invitee(item.user_id.into());
+ self.remove_invitee(item.user_id);
None
} else if let Some(user) = self.get_invitee(&item.user_id) {
// The avatar or the display name may have changed in the mean time
@@ -346,7 +344,7 @@ impl InviteeList {
.collect()
}
- fn remove_invitee(&self, user_id: Arc<UserId>) {
+ fn remove_invitee(&self, user_id: OwnedUserId) {
let removed = self.imp().invitee_list.borrow_mut().remove(&user_id);
if let Some(user) = removed {
user.set_invited(false);
diff --git a/src/session/content/room_history/item_row.rs b/src/session/content/room_history/item_row.rs
index a1e1c5ecf..2354d452b 100644
--- a/src/session/content/room_history/item_row.rs
+++ b/src/session/content/room_history/item_row.rs
@@ -113,7 +113,7 @@ mod imp {
let room_history = obj.room_history();
let popover = room_history.item_context_menu().to_owned();
- if event.message_content().is_some() {
+ if event.content().is_some() {
let menu_model = Self::Type::event_message_menu_model();
let reaction_chooser = room_history.item_reaction_chooser();
if popover.menu_model().as_ref() != Some(menu_model) {
diff --git a/src/session/content/room_history/state_row/mod.rs
b/src/session/content/room_history/state_row/mod.rs
index f296eb50a..674e505f9 100644
--- a/src/session/content/room_history/state_row/mod.rs
+++ b/src/session/content/room_history/state_row/mod.rs
@@ -5,9 +5,7 @@ use adw::{prelude::*, subclass::prelude::*};
use gettextrs::gettext;
use gtk::{glib, subclass::prelude::*, CompositeTemplate};
use log::warn;
-use matrix_sdk::ruma::events::{
- room::member::MembershipState, AnyStateEventContent, AnySyncStateEvent,
-};
+use matrix_sdk::ruma::events::{room::member::MembershipState, AnySyncStateEvent, SyncStateEvent};
use self::{creation::StateCreation, tombstone::StateTombstone};
use crate::gettext_f;
@@ -62,44 +60,39 @@ impl StateRow {
// We may want to show more state events in the future
// For a full list of state events see:
// https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk/events/enum.AnyStateEventContent.html
- let message = match state.content() {
- AnyStateEventContent::RoomCreate(event) => {
- WidgetType::Creation(StateCreation::new(&event))
+ let message = match state {
+ AnySyncStateEvent::RoomCreate(SyncStateEvent::Original(event)) => {
+ WidgetType::Creation(StateCreation::new(&event.content))
}
- AnyStateEventContent::RoomEncryption(_event) => {
+ AnySyncStateEvent::RoomEncryption(_event) => {
WidgetType::Text(gettext("This room is encrypted from this point on."))
}
- AnyStateEventContent::RoomMember(event) => {
- let display_name = event
+ AnySyncStateEvent::RoomMember(SyncStateEvent::Original(event)) => {
+ let content = &event.content;
+ let display_name = content
.displayname
.clone()
- .unwrap_or_else(|| state.state_key().into());
+ .unwrap_or_else(|| event.state_key.to_string());
- match event.membership {
+ match content.membership {
MembershipState::Join => {
- let message = match state.unsigned().prev_content {
- Some(AnyStateEventContent::RoomMember(prev))
- if event.membership != prev.membership =>
- {
- None
- }
- Some(AnyStateEventContent::RoomMember(prev))
- if event.displayname != prev.displayname =>
- {
- if let Some(prev_name) = prev.displayname {
- if event.displayname == None {
+ let message = match &event.unsigned.prev_content {
+ Some(prev) if content.membership != prev.membership => None,
+ Some(prev) if content.displayname != prev.displayname => {
+ if let Some(prev_name) = &prev.displayname {
+ if content.displayname == None {
Some(gettext_f(
// Translators: Do NOT translate the content between
// '{' and '}', this is a variable name.
"{previous_user_name} removed their display name.",
- &[("previous_user_name", &prev_name)],
+ &[("previous_user_name", prev_name)],
))
} else {
Some(gettext_f(
// Translators: Do NOT translate the content between
// '{' and '}', this is a variable name.
"{previous_user_name} changed their display name to
{new_user_name}.",
- &[("previous_user_name", &prev_name),
+ &[("previous_user_name", prev_name),
("new_user_name", &display_name)]
))
}
@@ -109,15 +102,13 @@ impl StateRow {
// '{' and '}', this is a variable name.
"{user_id} set their display name to {new_user_name}.",
&[
- ("user_id", state.state_key()),
+ ("user_id", event.state_key.as_ref()),
("new_user_name", &display_name),
],
))
}
}
- Some(AnyStateEventContent::RoomMember(prev))
- if event.avatar_url != prev.avatar_url =>
- {
+ Some(prev) if content.avatar_url != prev.avatar_url => {
if prev.avatar_url == None {
Some(gettext_f(
// Translators: Do NOT translate the content between
@@ -125,7 +116,7 @@ impl StateRow {
"{user} set their avatar.",
&[("user", &display_name)],
))
- } else if event.avatar_url == None {
+ } else if content.avatar_url == None {
Some(gettext_f(
// Translators: Do NOT translate the content between
// '{' and '}', this is a variable name.
@@ -166,11 +157,9 @@ impl StateRow {
))
}
MembershipState::Leave => {
- let message = match state.unsigned().prev_content {
- Some(AnyStateEventContent::RoomMember(prev))
- if prev.membership == MembershipState::Invite =>
- {
- if state.state_key() == state.sender() {
+ let message = match &event.unsigned.prev_content {
+ Some(prev) if prev.membership == MembershipState::Invite => {
+ if event.state_key == event.sender {
Some(gettext_f(
// Translators: Do NOT translate the content between
// '{' and '}', this is a variable name.
@@ -186,9 +175,7 @@ impl StateRow {
))
}
}
- Some(AnyStateEventContent::RoomMember(prev))
- if prev.membership == MembershipState::Ban =>
- {
+ Some(prev) if prev.membership == MembershipState::Ban => {
Some(gettext_f(
// Translators: Do NOT translate the content between
// '{' and '}', this is a variable name.
@@ -200,7 +187,7 @@ impl StateRow {
};
WidgetType::Text(message.unwrap_or_else(|| {
- if state.state_key() == state.sender() {
+ if event.state_key == event.sender {
// Translators: Do NOT translate the content between '{' and '}',
// this is a variable name.
gettext_f("{user} left the room.", &[("user", &display_name)])
@@ -221,25 +208,25 @@ impl StateRow {
&[("user", &display_name)],
)),
_ => {
- warn!("Unsupported room member event: {:?}", state);
+ warn!("Unsupported room member event: {:?}", event);
WidgetType::Text(gettext("An unsupported room member event was received."))
}
}
}
- AnyStateEventContent::RoomThirdPartyInvite(event) => {
- let display_name = match event.display_name {
- s if s.is_empty() => state.state_key().into(),
+ AnySyncStateEvent::RoomThirdPartyInvite(SyncStateEvent::Original(event)) => {
+ let display_name = match &event.content.display_name {
+ s if s.is_empty() => &event.state_key,
s => s,
};
WidgetType::Text(gettext_f(
// Translators: Do NOT translate the content between '{' and '}', this is a
// variable name.
"{user} was invited to this room.",
- &[("user", &display_name)],
+ &[("user", display_name)],
))
}
- AnyStateEventContent::RoomTombstone(event) => {
- WidgetType::Tombstone(StateTombstone::new(&event))
+ AnySyncStateEvent::RoomTombstone(SyncStateEvent::Original(event)) => {
+ WidgetType::Tombstone(StateTombstone::new(&event.content))
}
_ => {
warn!("Unsupported state event: {}", state.event_type());
diff --git a/src/session/media_viewer.rs b/src/session/media_viewer.rs
index e1ca83906..a9b8969aa 100644
--- a/src/session/media_viewer.rs
+++ b/src/session/media_viewer.rs
@@ -227,8 +227,7 @@ impl MediaViewer {
if let Some(event) = self.event() {
self.set_event_actions(Some(&event));
- if let Some(AnyMessageLikeEventContent::RoomMessage(content)) = event.message_content()
- {
+ if let Some(AnyMessageLikeEventContent::RoomMessage(content)) = event.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 5a686e76a..8de119523 100644
--- a/src/session/mod.rs
+++ b/src/session/mod.rs
@@ -40,7 +40,7 @@ use matrix_sdk::{
RoomId,
},
store::{make_store_config, OpenStoreError},
- Client, ClientBuildError, Error, HttpError,
+ Client, ClientBuildError, Error, HttpError, RumaApiError,
};
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use thiserror::Error;
@@ -700,9 +700,9 @@ impl Session {
}
}
Err(error) => {
- if let matrix_sdk::Error::Http(HttpError::ClientApi(
- FromHttpResponseError::Server(ServerError::Known(ref error)),
- )) = error
+ if let matrix_sdk::Error::Http(HttpError::Api(FromHttpResponseError::Server(
+ ServerError::Known(RumaApiError::ClientApi(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 b4722f9b9..8f46970b5 100644
--- a/src/session/room/event.rs
+++ b/src/session/room/event.rs
@@ -1,5 +1,3 @@
-use std::sync::Arc;
-
use gtk::{
glib,
glib::{clone, DateTime},
@@ -12,11 +10,14 @@ use matrix_sdk::{
media::MediaEventContent,
ruma::{
events::{
- room::message::{MessageType, Relation},
+ room::{
+ message::{MessageType, Relation},
+ redaction::SyncRoomRedactionEvent,
+ },
AnyMessageLikeEventContent, AnySyncMessageLikeEvent, AnySyncRoomEvent,
- AnySyncStateEvent, MessageLikeUnsigned,
+ AnySyncStateEvent, MessageLikeUnsigned, SyncMessageLikeEvent, SyncStateEvent,
},
- EventId, MilliSecondsSinceUnixEpoch, TransactionId, UserId,
+ MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedTransactionId, OwnedUserId,
},
Error as MatrixError,
};
@@ -95,6 +96,13 @@ mod imp {
None,
glib::ParamFlags::READABLE,
),
+ glib::ParamSpecObject::new(
+ "reactions",
+ "Reactions",
+ "The reactions related to this event",
+ ReactionList::static_type(),
+ glib::ParamFlags::READABLE,
+ ),
]
});
@@ -127,6 +135,7 @@ mod imp {
"source" => obj.source().to_value(),
"room" => obj.room().to_value(),
"time" => obj.time().to_value(),
+ "reactions" => obj.reactions().to_value(),
_ => unimplemented!(),
}
}
@@ -138,7 +147,7 @@ mod imp {
}
fn activatable(&self, obj: &Self::Type) -> bool {
- match obj.message_content() {
+ match obj.original_content() {
// The event can be activated to open the media viewer if it's an image or a video.
Some(AnyMessageLikeEventContent::RoomMessage(message)) => {
matches!(
@@ -151,7 +160,7 @@ mod imp {
}
fn can_hide_header(&self, obj: &Self::Type) -> bool {
- match obj.message_content() {
+ match obj.original_content() {
Some(AnyMessageLikeEventContent::RoomMessage(message)) => {
matches!(
message.msgtype,
@@ -223,7 +232,7 @@ impl Event {
self.notify("activatable");
}
- pub fn matrix_sender(&self) -> Arc<UserId> {
+ pub fn matrix_sender(&self) -> OwnedUserId {
let priv_ = self.imp();
if let Some(event) = priv_.event.borrow().as_ref() {
@@ -235,13 +244,13 @@ impl Event {
.as_ref()
.unwrap()
.event
- .get_field::<Arc<UserId>>("sender")
+ .get_field::<OwnedUserId>("sender")
.unwrap()
.unwrap()
}
}
- pub fn matrix_event_id(&self) -> Box<EventId> {
+ pub fn matrix_event_id(&self) -> OwnedEventId {
let priv_ = self.imp();
if let Some(event) = priv_.event.borrow().as_ref() {
@@ -253,13 +262,13 @@ impl Event {
.as_ref()
.unwrap()
.event
- .get_field::<Box<EventId>>("event_id")
+ .get_field::<OwnedEventId>("event_id")
.unwrap()
.unwrap()
}
}
- pub fn matrix_transaction_id(&self) -> Option<Box<TransactionId>> {
+ pub fn matrix_transaction_id(&self) -> Option<OwnedTransactionId> {
self.imp()
.pure_event
.borrow()
@@ -357,25 +366,31 @@ impl Event {
}
/// Find the related event if any
- pub fn related_matrix_event(&self) -> Option<Box<EventId>> {
+ pub fn related_matrix_event(&self) -> Option<OwnedEventId> {
match self.imp().event.borrow().as_ref()? {
AnySyncRoomEvent::MessageLike(ref message) => match message {
- AnySyncMessageLikeEvent::RoomRedaction(event) => Some(event.redacts.clone()),
- _ => match message.content() {
- AnyMessageLikeEventContent::Reaction(event) => Some(event.relates_to.event_id),
- AnyMessageLikeEventContent::RoomMessage(event) => match event.relates_to {
+ AnySyncMessageLikeEvent::RoomRedaction(SyncRoomRedactionEvent::Original(event)) => {
+ Some(event.redacts.clone())
+ }
+ AnySyncMessageLikeEvent::Reaction(SyncMessageLikeEvent::Original(event)) => {
+ Some(event.content.relates_to.event_id.clone())
+ }
+ AnySyncMessageLikeEvent::RoomMessage(SyncMessageLikeEvent::Original(event)) => {
+ match &event.content.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
- Relation::Reply { in_reply_to } => Some(in_reply_to.event_id),
- Relation::Replacement(replacement) => Some(replacement.event_id),
+ Relation::Reply { in_reply_to } => Some(in_reply_to.event_id.clone()),
+ Relation::Replacement(replacement) => {
+ Some(replacement.event_id.clone())
+ }
_ => None,
},
_ => None,
- },
- // TODO: RoomEncrypted needs https://github.com/ruma/ruma/issues/502
- _ => None,
- },
+ }
+ }
+ // TODO: RoomEncrypted needs https://github.com/ruma/ruma/issues/502
+ _ => None,
},
_ => None,
}
@@ -387,11 +402,12 @@ impl Event {
let priv_ = self.imp();
if self.related_matrix_event().is_some() {
- 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;
- }
+ if let Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(
+ SyncMessageLikeEvent::Original(message),
+ ))) = priv_.event.borrow().as_ref()
+ {
+ if let Some(Relation::Reply { in_reply_to: _ }) = message.content.relates_to {
+ return false;
}
}
return true;
@@ -399,55 +415,22 @@ impl Event {
let event = priv_.event.borrow();
- // List of all events to be hidden.
+ // List of all events to be shown.
match event.as_ref() {
- Some(AnySyncRoomEvent::MessageLike(message)) => matches!(
+ Some(AnySyncRoomEvent::MessageLike(message)) => !matches!(
message,
- 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(_)
+ AnySyncMessageLikeEvent::RoomMessage(SyncMessageLikeEvent::Original(_))
+ | AnySyncMessageLikeEvent::RoomEncrypted(SyncMessageLikeEvent::Original(_))
+ | AnySyncMessageLikeEvent::Sticker(SyncMessageLikeEvent::Original(_))
),
- Some(AnySyncRoomEvent::State(state)) => matches!(
+ Some(AnySyncRoomEvent::State(state)) => !matches!(
state,
- AnySyncStateEvent::PolicyRuleRoom(_)
- | AnySyncStateEvent::PolicyRuleServer(_)
- | AnySyncStateEvent::PolicyRuleUser(_)
- | AnySyncStateEvent::RoomAliases(_)
- | AnySyncStateEvent::RoomAvatar(_)
- | AnySyncStateEvent::RoomCanonicalAlias(_)
- | AnySyncStateEvent::RoomEncryption(_)
- | AnySyncStateEvent::RoomJoinRules(_)
- | AnySyncStateEvent::RoomName(_)
- | AnySyncStateEvent::RoomPinnedEvents(_)
- | AnySyncStateEvent::RoomPowerLevels(_)
- | AnySyncStateEvent::RoomServerAcl(_)
- | AnySyncStateEvent::RoomTopic(_)
- | AnySyncStateEvent::SpaceParent(_)
- | AnySyncStateEvent::SpaceChild(_)
+ AnySyncStateEvent::RoomCreate(SyncStateEvent::Original(_))
+ | AnySyncStateEvent::RoomMember(SyncStateEvent::Original(_))
+ | AnySyncStateEvent::RoomThirdPartyInvite(SyncStateEvent::Original(_))
+ | AnySyncStateEvent::RoomTombstone(SyncStateEvent::Original(_))
),
- Some(AnySyncRoomEvent::RedactedMessageLike(_)) => true,
- Some(AnySyncRoomEvent::RedactedState(_)) => true,
- _ => false,
- }
- }
-
- /// The content of this message.
- ///
- /// Returns `None` if this is not a message.
- pub fn message_content(&self) -> Option<AnyMessageLikeEventContent> {
- match self.matrix_event() {
- Some(AnySyncRoomEvent::MessageLike(message)) => Some(message.content()),
- _ => None,
+ _ => true,
}
}
@@ -459,7 +442,9 @@ impl Event {
/// - `RoomMessage` with `Relation::Replacement`
pub fn is_replacing_event(&self) -> bool {
match self.matrix_event() {
- Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(message))) => {
+ Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(
+ SyncMessageLikeEvent::Original(message),
+ ))) => {
matches!(message.content.relates_to, Some(Relation::Replacement(_)))
}
Some(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomRedaction(_))) => true,
@@ -542,7 +527,7 @@ impl Event {
/// Whether this is a reaction.
pub fn is_reaction(&self) -> bool {
matches!(
- self.message_content(),
+ self.original_content(),
Some(AnyMessageLikeEventContent::Reaction(_))
)
}
@@ -560,9 +545,11 @@ impl Event {
}
/// The content of this matrix event.
+ ///
+ /// Returns `None` if this is not a message-like event.
pub fn original_content(&self) -> Option<AnyMessageLikeEventContent> {
match self.matrix_event()? {
- AnySyncRoomEvent::MessageLike(message) => Some(message.content()),
+ AnySyncRoomEvent::MessageLike(message) => message.original_content(),
_ => None,
}
}
@@ -571,6 +558,8 @@ impl Event {
///
/// If this matrix event has been replaced, returns the replacing `Event`'s
/// content.
+ ///
+ /// Returns `None` if this is not a message-like event.
pub fn content(&self) -> Option<AnyMessageLikeEventContent> {
self.replacement()
.and_then(|replacement| replacement.content())
@@ -589,7 +578,7 @@ 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 AnyMessageLikeEventContent::RoomMessage(content) = self.message_content().unwrap() {
+ if let AnyMessageLikeEventContent::RoomMessage(content) = self.original_content().unwrap() {
let client = self.room().session().client();
match content.msgtype {
MessageType::File(content) => {
@@ -656,7 +645,7 @@ impl Event {
}
/// Get the id of the event this `Event` replies to, if any.
- pub fn reply_to_id(&self) -> Option<Box<EventId>> {
+ pub fn reply_to_id(&self) -> Option<OwnedEventId> {
match self.original_content()? {
AnyMessageLikeEventContent::RoomMessage(message) => {
if let Some(Relation::Reply { in_reply_to }) = message.relates_to {
diff --git a/src/session/room/event_actions.rs b/src/session/room/event_actions.rs
index fba9f61d1..ac38d9ff2 100644
--- a/src/session/room/event_actions.rs
+++ b/src/session/room/event_actions.rs
@@ -90,7 +90,7 @@ where
})
);
- if let Some(AnyMessageLikeEventContent::RoomMessage(message)) = event.message_content() {
+ if let Some(AnyMessageLikeEventContent::RoomMessage(message)) = event.content() {
let user_id = event
.room()
.session()
diff --git a/src/session/room/member.rs b/src/session/room/member.rs
index 5c47058f3..5b10224fd 100644
--- a/src/session/room/member.rs
+++ b/src/session/room/member.rs
@@ -3,9 +3,9 @@ use matrix_sdk::{
ruma::{
events::{
room::member::{MembershipState, RoomMemberEventContent},
- StrippedStateEvent, SyncStateEvent,
+ OriginalSyncStateEvent, StrippedStateEvent,
},
- MxcUri, UserId,
+ OwnedMxcUri, UserId,
},
RoomMember,
};
@@ -207,7 +207,7 @@ pub trait MemberEvent {
fn sender(&self) -> &UserId;
fn content(&self) -> &RoomMemberEventContent;
- fn avatar_url(&self) -> Option<Box<MxcUri>> {
+ fn avatar_url(&self) -> Option<OwnedMxcUri> {
self.content().avatar_url.to_owned()
}
@@ -223,7 +223,7 @@ pub trait MemberEvent {
}
}
-impl MemberEvent for SyncStateEvent<RoomMemberEventContent> {
+impl MemberEvent for OriginalSyncStateEvent<RoomMemberEventContent> {
fn sender(&self) -> &UserId {
&self.sender
}
diff --git a/src/session/room/member_list.rs b/src/session/room/member_list.rs
index 63f237c4b..8580e81d2 100644
--- a/src/session/room/member_list.rs
+++ b/src/session/room/member_list.rs
@@ -1,10 +1,11 @@
-use std::sync::Arc;
-
use gtk::{gio, glib, prelude::*, subclass::prelude::*};
use indexmap::IndexMap;
-use matrix_sdk::ruma::events::{room::member::RoomMemberEventContent, SyncStateEvent};
+use matrix_sdk::ruma::{
+ events::{room::member::RoomMemberEventContent, OriginalSyncStateEvent},
+ OwnedUserId, UserId,
+};
-use crate::session::room::{Member, Room, UserId};
+use crate::session::room::{Member, Room};
mod imp {
use std::cell::RefCell;
@@ -16,7 +17,7 @@ mod imp {
#[derive(Debug, Default)]
pub struct MemberList {
- pub members: RefCell<IndexMap<Arc<UserId>, Member>>,
+ pub members: RefCell<IndexMap<OwnedUserId, Member>>,
pub room: OnceCell<WeakRef<Room>>,
}
@@ -127,7 +128,7 @@ impl MemberList {
/// Returns the member with the given ID.
///
/// Creates a new member first if there is no member with the given ID.
- pub fn member_by_id(&self, user_id: Arc<UserId>) -> Member {
+ pub fn member_by_id(&self, user_id: OwnedUserId) -> Member {
let mut members = self.imp().members.borrow_mut();
let mut was_member_added = false;
let prev_len = members.len();
@@ -154,10 +155,12 @@ impl MemberList {
///
/// Creates a new member first if there is no member matching the given
/// event.
- pub fn update_member_for_member_event(&self, event: &SyncStateEvent<RoomMemberEventContent>) {
- if let Ok(user_id) = UserId::parse_arc(event.state_key.as_str()) {
- self.member_by_id(user_id).update_from_member_event(event);
- }
+ pub fn update_member_for_member_event(
+ &self,
+ event: &OriginalSyncStateEvent<RoomMemberEventContent>,
+ ) {
+ self.member_by_id(event.state_key.to_owned())
+ .update_from_member_event(event);
}
/// Returns whether the given user id is present in `MemberList`
diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs
index 2701001a4..9db979fe7 100644
--- a/src/session/room/mod.rs
+++ b/src/session/room/mod.rs
@@ -10,7 +10,7 @@ mod reaction_list;
mod room_type;
mod timeline;
-use std::{cell::RefCell, convert::TryInto, path::PathBuf, sync::Arc};
+use std::{cell::RefCell, convert::TryInto, path::PathBuf};
use gettextrs::gettext;
use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
@@ -28,18 +28,20 @@ use matrix_sdk::{
member::MembershipState,
message::{MessageType, Relation},
name::RoomNameEventContent,
- redaction::{RoomRedactionEventContent, SyncRoomRedactionEvent},
+ redaction::{OriginalSyncRoomRedactionEvent, RoomRedactionEventContent},
topic::RoomTopicEventContent,
},
tag::{TagInfo, TagName},
- AnyRoomAccountDataEvent, AnyStateEventContent, AnyStrippedStateEvent,
- AnySyncMessageLikeEvent, AnySyncRoomEvent, AnySyncStateEvent, EventContent,
- MessageLikeEventType, MessageLikeUnsigned, StateEventType, SyncMessageLikeEvent,
+ AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnySyncMessageLikeEvent,
+ AnySyncRoomEvent, AnySyncStateEvent, EventContent, MessageLikeEventType,
+ MessageLikeUnsigned, OriginalSyncMessageLikeEvent, StateEventType,
+ SyncMessageLikeEvent, SyncStateEvent,
},
receipt::ReceiptType,
serde::Raw,
- EventId, MilliSecondsSinceUnixEpoch, RoomId, UserId,
+ EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId,
},
+ DisplayName,
};
use ruma::events::SyncEphemeralRoomEvent;
@@ -83,7 +85,7 @@ mod imp {
#[derive(Default)]
pub struct Room {
- pub room_id: OnceCell<Box<RoomId>>,
+ pub room_id: OnceCell<OwnedRoomId>,
pub matrix_room: RefCell<Option<MatrixRoom>>,
pub session: OnceCell<WeakRef<Session>>,
pub name: RefCell<Option<String>>,
@@ -104,8 +106,8 @@ mod imp {
pub latest_read: RefCell<Option<Event>>,
/// The highlight state of the room,
pub highlight: Cell<HighlightFlags>,
- pub predecessor: OnceCell<Box<RoomId>>,
- pub successor: OnceCell<Box<RoomId>>,
+ pub predecessor: OnceCell<OwnedRoomId>,
+ pub successor: OnceCell<OwnedRoomId>,
/// The most recent verification request event.
pub verification: RefCell<Option<IdentityVerification>>,
}
@@ -756,7 +758,7 @@ impl Room {
for (event_id, receipts) in content.iter() {
if let Some(users) = receipts.get(&ReceiptType::Read) {
for user in users.keys() {
- if user == user_id.as_ref() {
+ if user == &user_id {
self.update_read_receipt(event_id.as_ref()).await;
return;
}
@@ -961,7 +963,18 @@ impl Room {
clone!(@weak self as obj => async move {
// FIXME: We should retry to if the request failed
match handle.await.unwrap() {
- Ok(display_name) => obj.set_display_name(Some(display_name)),
+ Ok(display_name) => { let name = match display_name {
+ DisplayName::Named(s) | DisplayName::Calculated(s) | DisplayName::Aliased(s) => {
+ s
+ }
+ // Translators: This is the name of a room that is empty but had another user
before.
+ // Do NOT translate the content between '{' and '}', this is a variable name.
+ DisplayName::EmptyWas(s) => gettext_f("Empty Room (was {user})", &[("user",
&s)]),
+ // Translators: This is the name of a room without other users.
+ DisplayName::Empty => gettext("Empty Room"),
+ };
+ obj.set_display_name(Some(name))
+ }
Err(error) => error!("Couldn’t fetch display name: {}", error),
};
})
@@ -1000,10 +1013,8 @@ impl Room {
};
let name_content = RoomNameEventContent::new(Some(room_name));
- let handle = spawn_tokio!(async move {
- let content = AnyStateEventContent::RoomName(name_content);
- joined_room.send_state_event(content, "").await
- });
+ let handle =
+ spawn_tokio!(async move { joined_room.send_state_event(name_content, "").await });
spawn!(
glib::PRIORITY_DEFAULT_IDLE,
@@ -1041,8 +1052,9 @@ impl Room {
};
let handle = spawn_tokio!(async move {
- let content = AnyStateEventContent::RoomTopic(RoomTopicEventContent::new(topic));
- joined_room.send_state_event(content, "").await
+ joined_room
+ .send_state_event(RoomTopicEventContent::new(topic), "")
+ .await
});
spawn!(
@@ -1111,27 +1123,29 @@ impl Room {
.collect();
for event in events.iter() {
- match event {
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomMember(event)) => {
- self.members().update_member_for_member_event(event)
- }
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomAvatar(event)) => {
- self.avatar().set_url(event.content.url.to_owned());
- }
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomName(_)) => {
- // FIXME: this doesn't take into account changes in the calculated name
- self.load_display_name()
- }
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomTopic(_)) => {
- self.notify("topic");
- }
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomPowerLevels(event)) => {
- self.power_levels().update_from_event(event.clone());
- }
- AnySyncRoomEvent::State(AnySyncStateEvent::RoomTombstone(_)) => {
- self.load_successor();
+ if let AnySyncRoomEvent::State(state_event) = event {
+ match state_event {
+ AnySyncStateEvent::RoomMember(SyncStateEvent::Original(event)) => {
+ self.members().update_member_for_member_event(event)
+ }
+ AnySyncStateEvent::RoomAvatar(SyncStateEvent::Original(event)) => {
+ self.avatar().set_url(event.content.url.to_owned());
+ }
+ AnySyncStateEvent::RoomName(_) => {
+ // FIXME: this doesn't take into account changes in the calculated name
+ self.load_display_name()
+ }
+ AnySyncStateEvent::RoomTopic(_) => {
+ self.notify("topic");
+ }
+ AnySyncStateEvent::RoomPowerLevels(SyncStateEvent::Original(event)) => {
+ self.power_levels().update_from_event(event.clone());
+ }
+ AnySyncStateEvent::RoomTombstone(_) => {
+ self.load_successor();
+ }
+ _ => {}
}
- _ => {}
}
}
self.session()
@@ -1207,7 +1221,7 @@ impl Room {
state_event
.and_then(|e| e.deserialize().ok())
.and_then(|e| {
- if let AnySyncStateEvent::RoomPowerLevels(e) = e {
+ if let AnySyncStateEvent::RoomPowerLevels(SyncStateEvent::Original(e)) = e {
Some(e)
} else {
None
@@ -1232,10 +1246,10 @@ impl Room {
) {
if let MatrixRoom::Joined(matrix_room) = self.matrix_room() {
let (txn_id, event_id) = pending_event_ids();
- let matrix_event = SyncMessageLikeEvent {
+ let matrix_event = OriginalSyncMessageLikeEvent {
content,
event_id,
- sender: self.session().user().unwrap().user_id().as_ref().to_owned(),
+ sender: self.session().user().unwrap().user_id(),
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
unsigned: MessageLikeUnsigned::default(),
};
@@ -1267,25 +1281,25 @@ impl Room {
}
/// Send a `key` reaction for the `relates_to` event ID in this room.
- pub fn send_reaction(&self, key: String, relates_to: Box<EventId>) {
+ pub fn send_reaction(&self, key: String, relates_to: OwnedEventId) {
self.send_room_message_event(ReactionEventContent::new(ReactionRelation::new(
relates_to, key,
)));
}
/// Redact `redacted_event_id` in this room because of `reason`.
- pub fn redact(&self, redacted_event_id: Box<EventId>, reason: Option<String>) {
+ pub fn redact(&self, redacted_event_id: OwnedEventId, reason: Option<String>) {
let (txn_id, event_id) = pending_event_ids();
let content = if let Some(reason) = reason.as_ref() {
RoomRedactionEventContent::with_reason(reason.clone())
} else {
RoomRedactionEventContent::new()
};
- let event = SyncRoomRedactionEvent {
+ let event = OriginalSyncRoomRedactionEvent {
content,
redacts: redacted_event_id.clone(),
event_id,
- sender: self.session().user().unwrap().user_id().as_ref().to_owned(),
+ sender: self.session().user().unwrap().user_id(),
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
unsigned: MessageLikeUnsigned::default(),
};
@@ -1533,7 +1547,7 @@ impl Room {
pub async fn invite(&self, users: &[User]) {
let matrix_room = self.matrix_room();
- let user_ids: Vec<Arc<UserId>> = users.iter().map(|user| user.user_id()).collect();
+ let user_ids: Vec<OwnedUserId> = users.iter().map(|user| user.user_id()).collect();
if let MatrixRoom::Joined(matrix_room) = matrix_room {
let handle = spawn_tokio!(async move {
@@ -1634,7 +1648,7 @@ impl Room {
fn count_as_unread(event: &AnySyncRoomEvent) -> bool {
match event {
AnySyncRoomEvent::MessageLike(message_event) => match message_event {
- AnySyncMessageLikeEvent::RoomMessage(message) => {
+ AnySyncMessageLikeEvent::RoomMessage(SyncMessageLikeEvent::Original(message)) => {
if matches!(message.content.msgtype, MessageType::Notice(_)) {
return false;
}
@@ -1645,11 +1659,11 @@ fn count_as_unread(event: &AnySyncRoomEvent) -> bool {
true
}
- AnySyncMessageLikeEvent::Sticker(_) => true,
+ AnySyncMessageLikeEvent::Sticker(SyncMessageLikeEvent::Original(_)) => true,
_ => false,
},
- AnySyncRoomEvent::State(state_event) => {
- matches!(state_event.event_type(), StateEventType::RoomTombstone)
+ AnySyncRoomEvent::State(AnySyncStateEvent::RoomTombstone(SyncStateEvent::Original(_))) => {
+ true
}
_ => false,
}
diff --git a/src/session/room/power_levels.rs b/src/session/room/power_levels.rs
index 5a462b6e2..08eda3e98 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, RoomEventType, SyncStateEvent,
+ room::power_levels::RoomPowerLevelsEventContent, OriginalSyncStateEvent, RoomEventType,
};
use crate::session::room::Member;
@@ -99,7 +99,7 @@ impl PowerLevels {
}
/// Updates the power levels from the given event.
- pub fn update_from_event(&self, event: SyncStateEvent<RoomPowerLevelsEventContent>) {
+ pub fn update_from_event(&self, event: OriginalSyncStateEvent<RoomPowerLevelsEventContent>) {
let content = BoxedPowerLevelsEventContent(event.content);
self.imp().content.replace(content);
self.notify("power-levels");
diff --git a/src/session/room/reaction_list.rs b/src/session/room/reaction_list.rs
index ae946b0aa..8f711464a 100644
--- a/src/session/room/reaction_list.rs
+++ b/src/session/room/reaction_list.rs
@@ -67,7 +67,7 @@ impl ReactionList {
// Group reactions by key
let mut grouped_reactions: HashMap<String, Vec<Event>> = HashMap::new();
for event in new_reactions {
- if let Some(AnyMessageLikeEventContent::Reaction(reaction)) = event.message_content() {
+ if let Some(AnyMessageLikeEventContent::Reaction(reaction)) = event.content() {
let relation = reaction.relates_to;
grouped_reactions
.entry(relation.key)
diff --git a/src/session/room/timeline/mod.rs b/src/session/room/timeline/mod.rs
index 11d89cc0d..1e47d51ad 100644
--- a/src/session/room/timeline/mod.rs
+++ b/src/session/room/timeline/mod.rs
@@ -14,7 +14,7 @@ use gtk::{gio, glib, prelude::*, subclass::prelude::*};
use log::{error, warn};
use matrix_sdk::{
deserialized_responses::SyncRoomEvent,
- ruma::{EventId, TransactionId},
+ ruma::{EventId, OwnedEventId, OwnedTransactionId, TransactionId},
Error as MatrixError,
};
pub use timeline_day_divider::TimelineDayDivider;
@@ -61,16 +61,16 @@ mod imp {
pub struct Timeline {
pub room: OnceCell<WeakRef<Room>>,
/// A store to keep track of related events that aren't known
- pub relates_to_events: RefCell<HashMap<Box<EventId>, Vec<Box<EventId>>>>,
+ pub relates_to_events: RefCell<HashMap<OwnedEventId, Vec<OwnedEventId>>>,
/// All events shown in the room history
pub list: RefCell<VecDeque<TimelineItem>>,
/// A Hashmap linking `EventId` to corresponding `Event`
- pub event_map: RefCell<HashMap<Box<EventId>, Event>>,
+ pub event_map: RefCell<HashMap<OwnedEventId, Event>>,
/// Maps the temporary `EventId` of the pending Event to the real
/// `EventId`
- pub pending_events: RefCell<HashMap<Box<TransactionId>, Box<EventId>>>,
+ pub pending_events: RefCell<HashMap<OwnedTransactionId, OwnedEventId>>,
/// A Hashset of `EventId`s that where just redacted.
- pub redacted_events: RefCell<HashSet<Box<EventId>>>,
+ pub redacted_events: RefCell<HashSet<OwnedEventId>>,
pub state: Cell<TimelineState>,
pub backward_stream: Arc<Mutex<Option<BackwardStream>>>,
pub forward_handle: Arc<Mutex<Option<JoinHandle<()>>>>,
@@ -417,7 +417,7 @@ impl Timeline {
let mut relates_to_events = priv_.relates_to_events.borrow_mut();
// Group events by related event
- let mut new_relations: HashMap<Box<EventId>, Vec<Event>> = HashMap::new();
+ let mut new_relations: HashMap<OwnedEventId, Vec<Event>> = HashMap::new();
for event in events {
if let Some(relates_to) = relates_to_events.remove(&event.matrix_event_id()) {
let mut replacing_events: Vec<Event> = vec![];
@@ -497,7 +497,7 @@ impl Timeline {
// `relates_to` once the `related_to` event is added to the list
let relates_to_event = relates_to_events.entry(relates_to_event_id).or_default();
- let relations_ids: Vec<Box<EventId>> = new_relations
+ let relations_ids: Vec<OwnedEventId> = new_relations
.iter()
.map(|event| event.matrix_event_id())
.collect();
@@ -665,10 +665,7 @@ impl Timeline {
};
added -= 1;
} else {
- priv_
- .event_map
- .borrow_mut()
- .insert(event_id.to_owned(), event.clone());
+ priv_.event_map.borrow_mut().insert(event_id, event.clone());
if event.is_hidden_event() {
hidden_events.push(event);
added -= 1;
diff --git a/src/session/room_creation/mod.rs b/src/session/room_creation/mod.rs
index 3778cd314..4b167ffa6 100644
--- a/src/session/room_creation/mod.rs
+++ b/src/session/room_creation/mod.rs
@@ -3,7 +3,7 @@ use std::convert::{TryFrom, TryInto};
use adw::subclass::prelude::*;
use gettextrs::gettext;
use gtk::{gdk, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
-use log::error;
+use log::{error, warn};
use matrix_sdk::{
ruma::{
api::{
@@ -13,11 +13,9 @@ use matrix_sdk::{
},
error::{FromHttpResponseError, ServerError},
},
- assign,
- common::RoomName,
- IdParseError,
+ assign, IdParseError, RoomName,
},
- HttpError,
+ HttpError, RumaApiError,
};
use crate::{
@@ -267,8 +265,8 @@ impl RoomCreation {
priv_.cancel_button.set_sensitive(true);
// Treat the room address already taken error special
- if let HttpError::ClientApi(FromHttpResponseError::Server(ServerError::Known(
- ref client_error,
+ if let HttpError::Api(FromHttpResponseError::Server(ServerError::Known(
+ RumaApiError::ClientApi(ref client_error),
))) = error
{
if client_error.kind == RumaClientErrorKind::RoomInUse {
@@ -294,14 +292,20 @@ impl RoomCreation {
let (is_name_valid, has_error) =
match <&RoomName>::try_from(priv_.room_name.text().as_str()) {
Ok(_) => (true, false),
- Err(IdParseError::EmptyRoomName) => (false, false),
+ Err(IdParseError::Empty) => (false, false),
Err(IdParseError::MaximumLengthExceeded) => {
priv_
.room_name_error
.set_text(&gettext("Too long. Use a shorter name."));
(false, true)
}
- Err(_) => unimplemented!(),
+ Err(error) => {
+ warn!("Invalid room name: {error:?}");
+ priv_
+ .room_name_error
+ .set_text(&gettext("Invalid room name."));
+ (false, true)
+ }
};
if has_error {
diff --git a/src/session/room_list.rs b/src/session/room_list.rs
index d0a6a20bd..4324193fd 100644
--- a/src/session/room_list.rs
+++ b/src/session/room_list.rs
@@ -5,7 +5,7 @@ use indexmap::map::IndexMap;
use log::error;
use matrix_sdk::{
deserialized_responses::Rooms as ResponseRooms,
- ruma::{RoomId, RoomOrAliasId},
+ ruma::{OwnedRoomId, OwnedRoomOrAliasId, RoomId, RoomOrAliasId},
};
use crate::{
@@ -25,8 +25,8 @@ mod imp {
#[derive(Debug, Default)]
pub struct RoomList {
- pub list: RefCell<IndexMap<Box<RoomId>, Room>>,
- pub pending_rooms: RefCell<HashSet<Box<RoomOrAliasId>>>,
+ pub list: RefCell<IndexMap<OwnedRoomId, Room>>,
+ pub pending_rooms: RefCell<HashSet<OwnedRoomOrAliasId>>,
pub session: OnceCell<WeakRef<Session>>,
}
@@ -135,7 +135,7 @@ impl RoomList {
self.emit_by_name::<()>("pending-rooms-changed", &[]);
}
- fn pending_rooms_insert(&self, identifier: Box<RoomOrAliasId>) {
+ fn pending_rooms_insert(&self, identifier: OwnedRoomOrAliasId) {
self.imp().pending_rooms.borrow_mut().insert(identifier);
self.emit_by_name::<()>("pending-rooms-changed", &[]);
}
@@ -156,7 +156,7 @@ impl RoomList {
}
/// Waits till the Room becomes available
- pub async fn get_wait(&self, room_id: Box<RoomId>) -> Option<Room> {
+ pub async fn get_wait(&self, room_id: OwnedRoomId) -> Option<Room> {
if let Some(room) = self.imp().list.borrow().get(&*room_id) {
Some(room.clone())
} else {
@@ -178,7 +178,7 @@ impl RoomList {
}
}
- fn get_full(&self, room_id: &RoomId) -> Option<(usize, Box<RoomId>, Room)> {
+ fn get_full(&self, room_id: &RoomId) -> Option<(usize, OwnedRoomId, Room)> {
self.imp()
.list
.borrow()
@@ -301,7 +301,7 @@ impl RoomList {
}
}
- pub fn join_by_id_or_alias(&self, identifier: Box<RoomOrAliasId>) {
+ pub fn join_by_id_or_alias(&self, identifier: OwnedRoomOrAliasId) {
let client = self.session().client();
let identifier_clone = identifier.clone();
diff --git a/src/session/user.rs b/src/session/user.rs
index 42308de4c..b94eb6436 100644
--- a/src/session/user.rs
+++ b/src/session/user.rs
@@ -1,10 +1,8 @@
-use std::sync::Arc;
-
use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
use log::error;
use matrix_sdk::{
encryption::identities::UserIdentity,
- ruma::{MxcUri, UserId},
+ ruma::{OwnedMxcUri, OwnedUserId, UserId},
};
use crate::{
@@ -37,7 +35,7 @@ mod imp {
#[derive(Debug, Default)]
pub struct User {
- pub user_id: OnceCell<Arc<UserId>>,
+ pub user_id: OnceCell<OwnedUserId>,
pub display_name: RefCell<Option<String>>,
pub session: OnceCell<WeakRef<Session>>,
pub avatar: OnceCell<Avatar>,
@@ -113,7 +111,7 @@ mod imp {
match pspec.name() {
"user-id" => {
self.user_id
- .set(UserId::parse_arc(value.get::<&str>().unwrap()).unwrap())
+ .set(UserId::parse(value.get::<&str>().unwrap()).unwrap())
.unwrap();
}
"display-name" => {
@@ -224,7 +222,7 @@ pub trait UserExt: IsA<User> {
.unwrap()
}
- fn user_id(&self) -> Arc<UserId> {
+ fn user_id(&self) -> OwnedUserId {
self.upcast_ref().imp().user_id.get().unwrap().clone()
}
@@ -250,7 +248,7 @@ pub trait UserExt: IsA<User> {
self.upcast_ref().imp().avatar.get().unwrap()
}
- fn set_avatar_url(&self, url: Option<Box<MxcUri>>) {
+ fn set_avatar_url(&self, url: Option<OwnedMxcUri>) {
self.avatar().set_url(url);
}
diff --git a/src/session/verification/verification_list.rs b/src/session/verification/verification_list.rs
index 3f4e76489..542856abb 100644
--- a/src/session/verification/verification_list.rs
+++ b/src/session/verification/verification_list.rs
@@ -1,13 +1,12 @@
-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::{
room::message::MessageType, AnySyncMessageLikeEvent, AnySyncRoomEvent, AnyToDeviceEvent,
+ SyncMessageLikeEvent,
},
- MilliSecondsSinceUnixEpoch, UserId,
+ MilliSecondsSinceUnixEpoch, OwnedUserId, UserId,
};
use crate::session::{
@@ -18,12 +17,12 @@ use crate::session::{
#[derive(Hash, PartialEq, Eq, Debug)]
pub struct FlowId {
- user_id: Arc<UserId>,
+ user_id: OwnedUserId,
flow_id: String,
}
impl FlowId {
- pub fn new(user_id: Arc<UserId>, flow_id: String) -> Self {
+ pub fn new(user_id: OwnedUserId, flow_id: String) -> Self {
Self { user_id, flow_id }
}
}
@@ -215,7 +214,7 @@ impl VerificationList {
}
}) {
let request = match message_event {
- AnySyncMessageLikeEvent::RoomMessage(message) => {
+ AnySyncMessageLikeEvent::RoomMessage(SyncMessageLikeEvent::Original(message)) => {
if let MessageType::VerificationRequest(request) = &message.content.msgtype {
debug!("Received in-room verification event: {:?}", message);
// Ignore request that are too old
@@ -232,10 +231,10 @@ impl VerificationList {
let user_to_verify = if *request.to == *user.user_id() {
// The request was sent by another user to verify us
- room.members().member_by_id(message.sender.clone().into())
+ room.members().member_by_id(message.sender.clone())
} else if *message.sender == *user.user_id() {
// The request was sent by us to verify another user
- room.members().member_by_id(request.to.clone().into())
+ room.members().member_by_id(request.to.clone())
} else {
// Ignore the request when it doesn't verify us or wasn't set by us
continue;
@@ -270,31 +269,39 @@ impl VerificationList {
continue;
}
- AnySyncMessageLikeEvent::KeyVerificationReady(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationReady(SyncMessageLikeEvent::Original(
+ e,
+ )) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationStart(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationStart(SyncMessageLikeEvent::Original(
+ e,
+ )) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationCancel(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationCancel(SyncMessageLikeEvent::Original(
+ e,
+ )) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationAccept(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationAccept(SyncMessageLikeEvent::Original(
+ e,
+ )) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationKey(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationKey(SyncMessageLikeEvent::Original(e)) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationMac(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationMac(SyncMessageLikeEvent::Original(e)) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
- AnySyncMessageLikeEvent::KeyVerificationDone(e) => {
+ AnySyncMessageLikeEvent::KeyVerificationDone(SyncMessageLikeEvent::Original(e)) => {
debug!("Received in-room verification event: {:?}", e);
self.get_by_id(&e.sender, &e.content.relates_to.event_id)
}
diff --git a/src/user_facing_error.rs b/src/user_facing_error.rs
index 902669363..286cafb8f 100644
--- a/src/user_facing_error.rs
+++ b/src/user_facing_error.rs
@@ -5,7 +5,7 @@ use matrix_sdk::{
error::{FromHttpResponseError, ServerError},
},
store::OpenStoreError,
- ClientBuildError, Error, HttpError,
+ ClientBuildError, Error, HttpError, RumaApiError,
};
use crate::ngettext_f;
@@ -25,7 +25,9 @@ impl UserFacingError for HttpError {
gettext("Unable to connect to the homeserver.")
}
}
- HttpError::ClientApi(FromHttpResponseError::Server(ServerError::Known(error))) => {
+ HttpError::Api(FromHttpResponseError::Server(ServerError::Known(
+ RumaApiError::ClientApi(error),
+ ))) => {
match error.kind {
Forbidden => gettext("The provided username or password is invalid."),
UserDeactivated => gettext("The account is deactivated."),
diff --git a/src/utils.rs b/src/utils.rs
index 8e9bedd4e..fbbd16702 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -67,7 +67,9 @@ use gtk::{
gio::{self, prelude::*},
glib::{self, closure, Object},
};
-use matrix_sdk::ruma::{events::room::MediaSource, EventId, TransactionId, UInt};
+use matrix_sdk::ruma::{
+ events::room::MediaSource, EventId, OwnedEventId, OwnedTransactionId, TransactionId, UInt,
+};
use mime::Mime;
// Returns an expression that is the and’ed result of the given boolean
@@ -205,7 +207,7 @@ pub fn filename_for_mime(mime_type: Option<&str>, fallback: Option<mime::Name>)
///
/// Returns a `(transaction_id, event_id)` tuple. The `event_id` is derived from
/// the `transaction_id`.
-pub fn pending_event_ids() -> (Box<TransactionId>, Box<EventId>) {
+pub fn pending_event_ids() -> (OwnedTransactionId, OwnedEventId) {
let txn_id = TransactionId::new();
let event_id = EventId::parse(format!("${}:fractal.gnome.org", txn_id)).unwrap();
(txn_id, event_id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]