Commit Graph

11696 Commits

Author SHA1 Message Date
Ivan Enderlin
e62313d7ba reefactor(base): Create the room::sync_v2::update_joined_room response processor.
This patch extracts the logic to handle a `JoinedRoom` in a response
processor.
2025-04-15 11:57:39 +02:00
Ivan Enderlin
71510de602 refactor(base): Extract timeline::builder::E2EE into e2ee, and use it more.
This patch moves the `timeline::builder::E2EE` type into the `e2ee`
module. Gathering these 3 E2EE values in the same type was a good idea,
and is now applied to more places in the response processors.
2025-04-15 11:57:39 +02:00
Ivan Enderlin
28888a414b refactor(base): Compute now if and only if Level::INFO is enabled.
This patch computes the `now` variable if and only if it is required.
It is used by an `info!` log, so let's condition the creation of `now`
to that.
2025-04-15 11:57:39 +02:00
Ivan Enderlin
3538bb91e3 refactor(base): Context derives Default.
This patch makes `Context` to derive `Default`. The `new` constructor
also no longer takes a `RoomInfoNotableUpdates`, since it was always
used with a default value, it generates this value by itself.
2025-04-15 11:57:39 +02:00
Ivan Enderlin
fdcc6dbeda chore(base): Replace an unwrap by an expect.
This patch updates a comment and replaces an `unwrap` by an `expect`.
2025-04-15 11:57:39 +02:00
dependabot[bot]
f1cd8120a8 chore(deps): Bump tj-actions/changed-files
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 6f67ee9ac810f0192ea7b3d2086406f97847bcf9 to 9b4bb2bedb217d3ede225b6b07ebde713177cd8f.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](6f67ee9ac8...9b4bb2bedb)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-version: 9b4bb2bedb217d3ede225b6b07ebde713177cd8f
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 11:31:54 +02:00
Richard van der Hoff
473852c7d5 Merge pull request #4922 from matrix-org/rav/check_sender_device_keys
crypto: check `sender_device_keys` on incoming Olm messages
2025-04-15 10:18:50 +01:00
Ivan Enderlin
f19f8b25db fix(sdk): Remove include_heroes in sliding sync requests.
This patch removes all mentions of `include_heroes`. This field isn't
part of the MSC4186. We have the `test_compute_heroes_from_sliding_sync`
which continues to pass, everything fine on that side. There is no
mention of `include_heroes` in Synapse at the time of writing. It seems
to be an artifact from the sliding sync proxy experiment.
2025-04-14 18:26:27 +02:00
Jonas Richard Richter
4de202fc64 doc(changelog): add entry for room topic string in StateEventContent 2025-04-14 15:43:17 +02:00
Jonas Richard Richter
7b206d33f0 feat(ffi): update RoomTopic AnySyncStateEvent variant to include topic string 2025-04-14 15:43:17 +02:00
Ivan Enderlin
085de8bdae refactor(base): Create the ephemeral_events response processor.
This patch creates the `ephemeral_events` response processors:
`dispatch` and `dispatch_one`.

This remove duplicated code.
2025-04-14 08:48:18 +02:00
Ivan Enderlin
fe0b954019 refactor(base): Create the dispatch_invite_and_knock response processor.
This patch creates the
`state_events::stripped::dispatch_invite_and_knock`, that is migrated
from the `BaseClient::handle_invite_state` method.
2025-04-14 08:48:18 +02:00
Ivan Enderlin
e21ae2ae53 chore(base): Move dispatch_and_get_new_users inside the sync module.
This patch moves the `state_events::dispatch_and_get_new_users`
processor inside the `state_events::sync` module. Why? Because a similar
processor for `state_events::stripped` is about to be created.
2025-04-14 08:48:18 +02:00
Jorge Martín
0306683cbf feat(ffi): Add extra details to ClientError.
Also split `ClientError::new` into `ClientError::from_str` and `ClientError::from_err` so we can automatically get the details from the 2nd one.
2025-04-11 15:49:20 +02:00
Richard van der Hoff
e020ba1023 crypto: check sender_device_keys on incoming Olm messages
MSC4147 added a `sender_device_keys` property to olm-encrypted to-device
messages, with recommendations about checking the values in that propety. We do
(most of?) those checks for `m.room_key` messages today, but not other types of
to-device message.
2025-04-11 12:00:18 +01:00
Richard van der Hoff
0697e0705b crypto: support MSC4147 device keys on custom to-device events
MSC4147 added a `sender_device_keys` property to the plaintext of *all*
olm-encrypted events. 03d4a30eb added the field to `DecryptedOlmV1Event`, but
due to Reasons, there is an almost-parallel struct `ToDeviceCustomEvent` which
is used for event types other than the 4 we have content types for.

To complete the set, let's add the field to `ToDeviceCustomEvent`.
2025-04-11 11:01:22 +01:00
Ivan Enderlin
1e938df90d Merge pull request #4921 from Hywan/release-0.11.0
chore: Release matrix-sdk version 0.11.0
matrix-sdk-crypto-ffi-0.11.0 matrix-sdk-indexeddb-0.11.0 matrix-sdk-0.11.0 matrix-sdk-ui-0.11.0 matrix-sdk-sqlite-0.11.0 matrix-sdk-ffi-0.11.0 matrix-sdk-test-macros-0.11.0 matrix-sdk-qrcode-0.11.0 matrix-sdk-crypto-0.11.0 matrix-sdk-store-encryption-0.11.0 matrix-sdk-test-0.11.0 matrix-sdk-base-0.11.0 matrix-sdk-common-0.11.0
2025-04-11 11:06:43 +02:00
Ivan Enderlin
5d55bb4955 chore: Release matrix-sdk version 0.11.0 2025-04-11 10:51:30 +02:00
Ivan Enderlin
8abd9fb303 doc(releasing): Fixing markdown.
Remove unbreakable spaces, and add indentations.
2025-04-11 10:42:37 +02:00
Ivan Enderlin
d5ee644443 refactor(base): Reorganize the state_events processors.
This patch tries to clarify the processors in `state_events` by
putting them in two modules: `sync` and `stripped`, along with a bit
of renaming:

- `collect_sync` becomes `sync::collect`,
- `collect_sync_from_timeline` becomes `sync::collect_from_timeline`,
- `collect_stripped` becomes `stripped::collect`.

I believe this is an improvement.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
06022aa23a chore(base): Remove a _ in front of a variable.
This ptach removes a `_` in front of a variable: it is used, if and only
if the `e2e-encryption` feature is enabled. Make it stand out.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
8ea0d9542d chore(base): Rename process_if_candidate to process_if_relevant. 2025-04-11 10:32:08 +02:00
Ivan Enderlin
63938bf2c7 chore(base): Remove an unnecessary allow(clippy…). 2025-04-11 10:32:08 +02:00
Ivan Enderlin
acff6c2e1d doc(base): Fix an intra-link in the documentation. 2025-04-11 10:32:08 +02:00
Ivan Enderlin
1013843071 refactor(base): Create the timeline::build response processor.
This patch does the following things:

1. moves the `BaseClient::handle_timeline` method as the
   `timeline::build` response processor.
2. moves the `BaseClient::update_push_room_context` method as a private
   function of the `timeline` response processor module,
3. moves the `BaseClient::get_push_room_context` method as a public
   function of the `timeline` response processor module.

The scope of the `timeline::build` processor is a bit too broad, but at
least the number of methods on `BaseClient` are greatly reduced.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
a0bfd3e21e chore(clippy): Make Clippy happy. 2025-04-11 10:32:08 +02:00
Ivan Enderlin
68352e8339 chore(base): Rename variables for the sake of clarity.
Don't know what `event`, `e`, `e`, `e` or `r` represent? Me neither.
This patch tries to fix that.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
6a5e24a64a refactor(base): Create the verification::process_if_candidate response processor.
This patch creates a new `verification::process_if_candidate` response
process. The idea is the check whether a `AnySyncTimelineEvent` suits to
be a verification event that must be processed.

This piece of code was repeated in three different places in the code.
Now it's unique.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
db6d1b4cd6 refactor(base): BaseClient::handle_timeline no longer handle state events.
This patch removes the `ignore_state_events` argument from
`BaseClient::handle_timeline`. This method no longer handles state
events. Consequently, the `user_ids` and `ambiguity_cache` arguments are
also removed.

This patch updates the flow to use the new
`state_events::collect_sync_from_timeline` processor, and to re-use the
`state_events::dispatch_and_get_new_users` processor.

The positive impact of this patch is that it re-uses existing code
(hurray). However, the downside is that state events are deserialized
twice for the moment.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
b0c1eda682 refactor(base): Create the state_events::dispatch_and_get_new_users response processor.
This patch extracts the `BaseClient::handle_state` method as a new
response processor named `state_events::dispatch_and_get_new_users`.
It appears that we can do something more elegant with the returned new
users. See the next patch.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
afecd6d508 chore(base): Simplify code by calling iter::zip instead of Iterator::zip.
This patch uses `iter::zip` to replace `Iterator::zip`. It does exactly
the same, it's just shorter.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
52b490f5b6 chore(base): Remove allow(unused_mut) for the context.
This is used everytime now :-).
2025-04-11 10:32:08 +02:00
Ivan Enderlin
097558ca1b chore(base): Rewrite code to avoid an allocation and calling twice the same function.
This patch rewrites `e2e::decrypt::sync_timeline_event` to avoid calling
a `verification` twice with the same arguments, and to avoid a string
allocation (the `to_string`).

Also, I wasn't comfortable with the `starts_with` which wasn't included
a trailing `.`. At least now we rely on strongly typed event type.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
2194a81d74 refactor(base): Create the e2ee::decrypt::sync_timeline_event response processor.
This patch extracts the `BaseClient::decrypt_sync_room_event` method
into the new `e2ee::decrypt::sync_timeline_event` response processor.
2025-04-11 10:32:08 +02:00
Ivan Enderlin
37146da27a chore(base): Rename from_sync_v3 to …_v2.
The version of something is 3 but the sync version is 2. Confusing.
2025-04-11 10:32:08 +02:00
Mauro Romito
9300f47b40 feat(bindings): join_rule in NotificationItem 2025-04-11 10:29:59 +02:00
Mauro Romito
52f0aafb1e feat(bindings): expose is_public in notifications 2025-04-11 10:29:59 +02:00
dependabot[bot]
bfbbe89989 chore(deps): Bump crossbeam-channel from 0.5.13 to 0.5.15
Bumps [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) from 0.5.13 to 0.5.15.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.13...crossbeam-channel-0.5.15)

---
updated-dependencies:
- dependency-name: crossbeam-channel
  dependency-version: 0.5.15
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-10 16:52:10 +02:00
Richard van der Hoff
d25e236a75 Merge pull request #4917 from matrix-org/rav/tracing_improvements
Cleanups and extensions to tracing span logic
2025-04-10 11:47:53 +01:00
Damir Jelić
ab90c1b945 refactor(sdk): Migrate away from the backoff crate to the backon crate
Since backon also has WASM support, this should mean that we can get rid
of the WASM specific HTTP client implementation.
2025-04-10 11:58:06 +02:00
Jorge Martín
005e506c9b refactor(ffi): expose Room::member_with_sender_info.
Reuse this for `RoomPreview` too, removing `RoomMembershipDetails`, which contained the same info.
2025-04-10 09:48:15 +02:00
Jorge Martín
3fe457db83 refactor(room): change Room::own_membership_details to member_with_sender_info.
The function will now return the previously added `RoomMemberWithSenderInfo` struct.
2025-04-10 09:48:15 +02:00
Jorge Martín
69ab855efa refactor(room): add RoomMemberWithSenderInfo struct.
This will hold the info for both the room member whose sender id was provided and the sender of the `m.room.member` event from which the `RoomMember` is built.
2025-04-10 09:48:15 +02:00
Richard van der Hoff
66c7ba60a9 sdk: reduce clobber attached to tracing spans for http requests
We don't need to list the `server_versions` every time we do an http
request. Further, `config` is listed under both `skip` and `fields`, which ends
up being a no-op. I don't think it's very useful (and is quite noisy), so
let's remove it.
2025-04-09 19:55:38 +01:00
Richard van der Hoff
3e320b8289 sdk: propagate tracing span for outgoing requests
In parallel to a sliding sync request, we also check for and send pending outgoing
requests from the crypto stack. Currently, these drop the tracing span, which
loses valuable data. We should propagate the span.

We also add an extra layer of instrumentation so that we can differentiate
between the results of the sliding sync itself, and the outgoing requests.
2025-04-09 19:55:38 +01:00
Richard van der Hoff
2922389037 UI: Allow attaching a parent tracing span for sync service
Currently, if you have two clients both syncing away inside the same process,
it's approximately impossible to see which logs belong to which client. It
would be much better if we could use a tracing span to distinguish the two
clients.

I expect this to be mostly useful in integration tests, but it might be useful
elsewhere too.
2025-04-09 19:54:01 +01:00
Damir Jelić
68e3cdebdd chore: Bump the blake3 version 2025-04-09 16:37:40 +02:00
Damir Jelić
511cf78d51 chore: Bump the rusqlite version 2025-04-09 16:37:40 +02:00
Damir Jelić
f4eea708fa chore: Update the ByteSize crate version we're using 2025-04-09 16:37:40 +02:00
Richard van der Hoff
1d3107ebcb multiverse: reduce redraw rate
This reduces the framerate from ~62fps to 10fps.

This is a workaround for a problem in my terminal, so apologies for inflicting
it on everyone else, but here we are, and 10fps seems like it should be enough
for anyone.

The problem in question is specifically when I try to select some text by
dragging the mouse (eg, to copy a generated recovery key). If I start a drag,
but a redraw happens before the mouse has moved [a certain distance?], then the
drag doesn't work, and nothing gets selected. By reducing the framerate, I have
a much better chance of successfully starting a drag.
2025-04-09 16:10:31 +02:00