Commit Graph

585 Commits

Author SHA1 Message Date
Kévin Commaille
0e622cc5a1 Upgrade Ruma (phase 3)
This upgrade introduces support for room version 12[1].

[1]: https://matrix.org/blog/2025/07/security-predisclosure/)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-23 14:32:05 +00:00
Kévin Commaille
4931c0749e Upgrade Ruma again
This patch updates our `Raw` API usage since the newly added `JsonCastable` that disallows Raw casts that are known to fail deserialization. 

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 12:59:26 +00:00
Kévin Commaille
37626b5ad9 Bump Ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 14:00:53 +02:00
Damir Jelić
b3c1ca1577 Use the invite details when deciding if we should accept a bundle 2025-07-17 16:39:17 +02:00
Jonas Platte
7d9d5bf3b4 refactor: Use if-let chain 2025-07-15 08:41:44 +02:00
Jonas Platte
ea076b3d76 chore: Upgrade testing crates to Rust Edition 2024 2025-07-15 08:41:44 +02:00
Damir Jelić
18b169ca7e chore: Release matrix-sdk version 0.13.0 2025-07-10 15:15:04 +02:00
Ivan Enderlin
1c549a3ca1 test(sdk): Test LatestEventValue is being updated. 2025-07-08 14:47:43 +02:00
Kévin Commaille
849d705cd1 refactor(sdk): Port client tests to MatrixMockServer and MockClientBuilder
Because it's such a nicer API!

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-07 09:42:47 +02:00
Jonas Platte
07808b4301 refactor: Enable extra code style clippy lints 2025-07-05 21:20:34 +02:00
Kévin Commaille
c98b2a1b3f refactor(test): Change the bound on EventBuilder to StaticEventContent
The `EventContent` trait is gone in Ruma so this will ease the upgrade
to the next breaking release.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-04 12:13:22 +03:00
Benjamin Bouvier
f0b6225e40 feat(notifications): provide the NotificationStatus as the return type when getting notifications
This is more explicit for these API's users, which can decide to do
different things based on whether an event has been ignored, or filtered
out.
2025-07-03 17:14:56 +02:00
Jonas Platte
3d642356c6 refactor: Clean up formatting in many places
Process:
- set style_edition to 2024 in .rustfmt.toml
- run `cargo fmt`
- undo .rustfmt.toml change
- run `cargo fmt` again
- manually rewrap some strings
2025-06-27 19:54:13 +02:00
Richard van der Hoff
4ecd599c15 fix(sdk): correctly import e2ee history in join_room_by_id (#5284)
It turns out that downstream clients can and do call
`Client::join_room_by_id()` rather than `Room::join`, so we need to do
the room key history import in the lower-level method.

---------

Signed-off-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
2025-06-27 12:29:01 +01:00
Damir Jelić
3a98d46bfa feat: Add a stream to listen for historic room key bundles 2025-06-26 13:22:24 +02:00
Benjamin Bouvier
bc9192f818 refactor!(sdk): make the join_rule and related getters optional
The join rule state event can be missing from a room state. In this
case, it's an API footgun to return a default value; instead, we should
return none and let the caller decide what to do with missing
information.
2025-06-25 10:32:01 +02:00
Doug
ea28234d95 sdk: Cache the client well-known file and add Client::rtc_foci which uses it. 2025-06-19 17:40:04 +02:00
Valere Fedronic
7126fc8a29 feat(crypto): Emmit EncryptionInfo with event handlers for to-device messages as well 2025-06-13 14:31:22 +02:00
Damir Jelić
b41efb063e chore: Release matrix-sdk version 0.12.0 2025-06-10 13:33:01 +02:00
Benjamin Bouvier
7a6e29c347 feat(ui): don't mark each thread reply as an actual reply to the previous message, in threaded timelines
This correctly handles the reply fallback behavior:

- the behavior isn't changed for a live timeline,
- when a timeline is thread-focused, we will extract the `replied_to`
field if and only if the thread relation is *not* marked as behaving in
a fallback manner.

This makes it possible to distinguish actual in-thread replies.
2025-06-10 09:03:30 +02:00
Benjamin Bouvier
2aeb1a0353 refactor(sdk): rename TimelineEvent::new to from_plaintext 2025-06-06 13:34:12 +03:00
Benjamin Bouvier
a1ad772642 refactor(sdk): rename TimelineEvent::new_utd_event to from_utd 2025-06-06 13:34:12 +03:00
Daniel Salinas
d3be744244 feat(wasm): Remove direct use of tokio::spawn in favor of matrix-sdk-common (#5159)
Mechanical move from tokio::spawn to matrix_sdk_common::executor::spawn
that has support for Wasm platforms. On non-Wasm, this shim defaults to
tokio::spawn.
2025-06-03 12:22:53 -04:00
Johannes Marbach
ee06965d2e feat(timeline): Expose method to send galleries in matrix-sdk-ui (#5125)
This was broken out of
https://github.com/matrix-org/matrix-rust-sdk/pull/4838 and is a step
towards implementing
https://github.com/matrix-org/matrix-spec-proposals/pull/4274. Building
upon https://github.com/matrix-org/matrix-rust-sdk/pull/4977, a new
method `Timeline::send_gallery` in matrix-sdk-ui for sending galleries.

- [x] Public API changes documented in changelogs (optional)

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-06-03 15:24:02 +02:00
Yousef Moazzam
a099879563 test: add reply thread relation method to sticker event builder 2025-06-03 13:19:34 +02:00
Yousef Moazzam
b6569762db test: add sticker event method to EventFactory 2025-06-03 13:19:34 +02:00
Richard van der Hoff
a1e2eed467 sdk: Add ClientBuilder::with_enable_share_history_on_invite (#5141)
Replace `experimental-share-history-on-invite` feature flag with a
runtime flag on the `Client`.
2025-06-03 11:36:48 +01:00
Daniel Salinas
c6e55c1a36 Mechanical move from target_arch="wasm32" to target_family="wasm" 2025-06-02 17:27:34 +02:00
Benjamin Bouvier
f2a90cb921 test: use helpers to create a bundled edit and thread summary 2025-06-02 16:24:25 +02:00
Damir Jelić
42ade32bea feat(sdk): Fallback to the device keys in the Olm event for room key bundles
This makes it possible to correctly accept a historic room key bundle if
we previously didn't know about the device of the sender of the bundle.
2025-05-30 15:45:27 +02:00
Robin
2c8e71e560 refactor(tests): Allow converting EventBuilder to state 2025-05-30 15:32:35 +02:00
Robin
6f683d3cde refactor(tests): Accept more types for sync builder state events
Refactoring the test event implementation to use the From trait rather than ad-hoc methods along the way.
2025-05-30 15:32:35 +02:00
Jonas Platte
8eec683793 refactor: Use inline format arguments more
Automated with cargo clippy --fix --workspace --all-targets.
2025-05-29 13:19:59 +02:00
Jonas Platte
3c20ee41d6 chore: Fix clippy lints 2025-05-29 10:59:56 +02:00
Damir Jelić
60d3b3d56b test: Finish up the shared history integration test 2025-05-27 17:46:10 +02:00
Damir Jelić
995838d9d3 refactor(tests): Move the shared history test into its own module 2025-05-27 17:46:10 +02:00
Damir Jelić
1d4d4bc741 refactor(tests): Create a submodule for the end-to-end encryption integration tests 2025-05-27 17:46:10 +02:00
Benjamin Bouvier
42a4a6c1a8 refactor(ui): get rid of the RoomListService::Room wrapper
It's just a room, now! Since there were some users of the
`latest_event()` that returned an `EventTimelineItem`, I kept this
method as a method in the Room trait extension that's in the UI crate,
so it's still convenient to use.
2025-05-26 14:48:16 +02:00
Ivan Enderlin
bfac815a5e test: EventBuilder<RoomCreateEventContent> can set predecessor.
This patch adds the `predecessor` and `no_predecessor` methods on
`EventBuilder<RoomCreateEventContent>`. This is helpful to configure the
`predecessor` field.
2025-05-23 11:35:53 +02:00
Ivan Enderlin
95e8d0589b test: Fix EventFactory::create.
This patch fixes `EventFactory::create` where the `m.room.create` wasn't
created as a state-event (the `state_key` field was missing).

Also, it uses the `creator_user_id` in the `sender` field if no sender
was given.
2025-05-23 11:35:53 +02:00
Ivan Enderlin
16a923edda test: Simplify EventBuilder::into_raw_timeline.
This patch simplifies `EventBuilder::into_raw_timeline`. It is exactly
like `EventBuilder::into_raw`, so let's use it.
2025-05-23 11:35:53 +02:00
Ivan Enderlin
9c227c2321 feat(base): Add Room::successor_room and Room::predecessor_room.
First off, this patch renames `Room::tombstone` to
`Room::tombstone_content` (to be consistent with other methods, such as
`Room::create_content`).

Second, this patch adds the `Room::successor_room` and
`Room::predecessor_room` methods, along with the `SuccessorRoom` and
`PredecessorRoom` types. This naming more or less comes from the Matrix
specification:

- the term _predecessor_ is part of the specification,
- the term _successor_ isn't present _per se_, the words _replacement
  room_ are used instead, but I prefer _successor_ as it brings a nice
  symmetry with _predecessor_.
2025-05-23 11:35:53 +02:00
Jonas Platte
3aa356dcd6 chore: Use shorter syntax for workspace inheritance where possible 2025-05-23 10:23:36 +02:00
Jonas Platte
491f7cd529 chore: Clean up Cargo.toml formatting 2025-05-23 10:23:36 +02:00
Timo
6d5ad4eddc feat(widget-driver): Add to-device support
The widget Driver should be able to send and receive to-device events.
This is useful for element call encryption keys.

This PR focusses on the widget driver and machine logic. To
send/communicate the events from the widget to the driver.

It skips any encryption logic. Some of the encryption logic will be part
of crypto crate and the code in the widget driver crate should be kept
minimal once the crypto crate is ready.

---------

Co-authored-by: Valere <bill.carson@valrsoft.com>
2025-05-22 13:38:28 +02:00
Benjamin Bouvier
5c6238f132 chore(deps): bump wasm-bindgen-test 2025-05-22 11:50:13 +02:00
Kévin Commaille
51be581d48 feat(test): Add RoomAccountDataTestEvent::MarkedUnread
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-21 13:51:48 +02:00
Benjamin Bouvier
16fe53c40d refactor!(timeline): have TimelineItem::reactions() return an Option<&ReactionsByKeyBySender> instead of owned non-optional 2025-05-20 13:50:02 +02:00
Yousef Moazzam
f173510482 test: Replace sync_timeline_event! with EventFactory for beacon events in room integration tests 2025-05-20 12:31:23 +02:00
Ivan Enderlin
2649587d2f refactor(sdk): Use the Event Cache for read_receipts::compute_unread_counts.
The `read_receipts::compute_unread_counts` function needs the _previous
events_ to compute the read receipt correctly. These previous events
were store in `SlidingSyncRoom::timeline_queue`. Since the removal of
`timeline_queue` in the previous patches, this patch uses the Event
Cache to fetch them. It only uses events that are loaded in memory.
This is as correct as the prior behaviour, even this is still incorrect
since it doesn't back-paginate to get a better view. This is for
later. The goal of this patch is to restore the same behaviour, without
`timeline_queue`.

The main problem is that read receipts are computed in
`matrix-sdk-base`, and that the Event Cache lives in `matrix-sdk`. Thus,
we change the `SlidingSyncResponseProcessor` to handle read receipt
in particular.

The
`matrix_sdk_base::response_processors::rooms::msc4186::extensions::dispa
tch_ephemeral_events` function has been split in
two methods `dispatch_typing_ephemeral_events`, and
`dispatch_receipt_ephemeral_event_for_room`. The workflow has been a
little bit redesigned to fit in the new `SlidingSyncResponseProcessor`
constraints.

This patch moves one test from `matrix-sdk-base` into `matrix-sdk`,
because to compute the read receipt, the Event Cache must be
enabled/listening to sync updates.
2025-05-16 14:43:45 +02:00