Commit Graph

606 Commits

Author SHA1 Message Date
Benjamin Bouvier
e6b1ffba99 tests: add support for the global account PushRules event in the event factory 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
9a3ceb8be6 tests: add support for the global account IgnoredUserList event in the event factory 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
faee647c3a tests: get rid of GlobalAccountDataTestEvent::Direct 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
1866143456 tests: add support for the global account Direct event in the event factory 2025-08-21 15:21:14 +02:00
Skye Elliot
7adaf7be73 feat(sdk): Rename state encryption methods for improved clarity
Changes `Room::enable_encryption_with_state` to
`Room::enable_encryption_with_encrypted_state_events`, and updates the
respective unit test and testing utilities.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-20 12:28:03 +02:00
Skye Elliot
b73163aa45 feat(sdk): Add Room::enable_encryption_with_state
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-20 12:28:03 +02:00
dragonfly1033
13c30f6691 feat(sdk): Add creation of indexes and indexing of messages (#5505)
Integrate matrix-sdk-search into matrix-sdk.
When a room is joined, a corresponding index is created.
When a message is received via sync or via a back-pagination, it is
added to the corresponding room's index.

Signed-off-by: Shrey Patel shreyp@element.io
2025-08-18 14:52:09 +02:00
Kévin Commaille
a3a239f999 Upgrade Ruma: revert StrippedState
Handle the previous breaking change that was reverted: `StrippedState`
was removed and `AnyStrippedStateEvent` is used again.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-14 08:57:52 +02:00
multisme
a66b2c5123 feat(test): add a test utils crate to make log initialization possible everywhere
This PR allows `init_tracing_for_test` to be called by any other crate in the sdk

Signed-off-by: multi [multiestunhappydev@gmail.com](mailto:multiestunhappydev@gmail.com)
2025-08-14 05:24:03 +00:00
Kévin Commaille
7724271508 doc(test): Fix method auto-link
Rustdoc doesn't support passing parameters for auto-links.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-13 12:31:22 +01:00
Johannes Marbach
0a796cb468 feat(timeline): communicate media upload progress through EventSendState::NotSentYet
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-08-12 12:57:18 +02:00
Damir Jelić
b29886c0df test(crypto): Add a test that we refuse bundles if the sender isn't trusted enough 2025-08-08 15:56:13 +02:00
dragonfly1033
992774b8b5 Add the matrix-sdk-search crate
A new crate with a basic API for a creating, populating and searching a
room message index.

Signed-off-by: Shrey Patel shreyp@element.io
2025-08-07 16:01:41 +02:00
Jonas Platte
42d2b93489 refactor: Introduce TestResult and use it in a couple random places 2025-08-06 22:21:39 +00:00
Benjamin Bouvier
b585963abb test(notification client): check msc4306 behavior in the notification client too 2025-08-06 15:28:43 +02:00
Kévin Commaille
056e90db25 feat(sdk): Use state_after in sync v2 (#5488)
It is supposed to be an improvement over `state`, since it allows the
server to send updates to the state that might not be reflected in the
timeline.

This is also the same behavior as in Simplified Sliding Sync.

This is MSC4222 that was accepted and is about to get merged in the
spec.

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-06 13:42:49 +01:00
Kévin Commaille
787861eb35 fix: Upgrade Ruma
This brings 2 important bug fixes:

- Make deprecated fields of `m.room.encrypted` optional: it seems that there are events without these fields in the wild.
- Fix deserialization of `RedactedRoomJoinRulesEventContent`. This was found by a bug report in Fractal that caused the same error as #3557 when restoring the client. So maybe we could consider that this bug is fixed? It is still possible that there is another deserialization error. 

There is also a breaking change in the format of the `state` field in response to `GET /v3/sync`.
2025-08-05 16:04:34 +02:00
Hubert Chathi
a4da6ba7c8 Exclude insecure devices on Olm encryption (#5457)
Fixes the encrypting part of
https://github.com/matrix-org/matrix-rust-sdk/issues/4147

Probably easiest to review commit-by-commit

<!-- description of the changes in this PR -->

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

<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by:
2025-08-04 08:50:32 +01:00
Kévin Commaille
b02e1da471 Upgrade Ruma
This brings in a new breaking change from Ruma, because not all events
are stripped in a room's stripped state. For simplicity, this still
considers the events as stripped during deserialization for now, since
this format is compatible with the other possible formats.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-01 14:07:28 +02:00
Damir Jelić
88360040fb test(timeline): Add some integration tests for the redecryption logic
These tests now fully mock all the end-to-end encryption server
endpoints to test the redecryption and UTD item replacement logic of the
timeline without any manual room key insertions.

We test that the item replacement correctly handles supported event
types as well as unsupported ones.
2025-07-30 12:46:04 +02:00
Kévin Commaille
0a7ac18d9f refactor: Add IsPrefix = False bound on StaticEventContent bounds
Since those APIs only support a full event type, not an event type prefix.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-25 17:36:19 +02:00
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