Commit Graph

650 Commits

Author SHA1 Message Date
Benjamin Bouvier
50cc5f4102 refactor(pinned events): move pin_event/unpin_event from the Timeline to the Room
These make sense in general, and they will help getting rid of one of
the `PinnedEventsRoom` trait methods in a subsequent PR.
2026-02-04 09:59:47 +01:00
Kévin Commaille
be8abdc1cf test(sdk): Add tests about handling invalid state events
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Benjamin Bouvier
3989e483d5 chore(send queue): save the thumbnail as the thumbnail of itself 2026-01-22 13:31:49 +01:00
Benjamin Bouvier
32666e4c24 feat(send queue): cache a thumbnail as such for the media that we just uploaded
Before: after uploading a media and a thumbnail with the send queue, the
thumbnail would be cached only as a "file", and not as a thumbnail. This
is wasteful, if the embedder is interested in getting a thumbnail of the
exact same dimensions, for the file they've updated; there's no good
reason to wait for the server to return it back.

However, there were good reasons to store it as a file in the past. So,
we're choosing here to duplicate the thumbnail in the media store:
- it's saved as a file for its own MXC URI (which preserves the previous
behavior)
- it's also saved as a thumbnail for the media MXC URI (which implements
the desired behavior).

Tests are updated to reflect this.
2026-01-22 13:31:49 +01:00
Ivan Enderlin
e9f5ed108a test(sdk): Add test_latest_event_is_recomputed_when_a_user_is_ignored.
This patch adds a test to ensure the `LatestEventValue` is re-computed
(more specifically: erased) when a user is ignored.
2026-01-16 15:01:52 +01:00
Doug
d64c990658 feat: Add a method to set your own user's display name within a room
For e.g. the /myroomnick slash command.
2026-01-14 14:15:22 +02:00
Skye Elliot
cd9f433358 Merge pull request #5945 from matrix-org/kaylendog/history-sharing/encryption-info
feat: Add `forwarder: ForwarderInfo` to `EncryptionInfo`.

Introduces `ForwarderInfo` which which exposes information about the forwarder of the  keys with which an event was encrypted if they were shared as part of an [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268) room key bundle.
2025-12-19 17:29:22 +00:00
Richard van der Hoff
f753d478fa feat: Add forwarder_data to InboundGroupSession and pickle.
- Introduces `forwarder_data` to IGS and its pickled form, and a
  helper method to import them from `HistoricRoomKey`s.

Issue: https://github.com/matrix-org/matrix-rust-sdk/issues/5109

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-12-17 12:33:16 +00:00
Stefan Ceriu
98f34f010c change(room::futures): Use a proper struct instead of a tuple for SendMessageLikeEvent results 2025-12-09 18:49:03 +01:00
Stefan Ceriu
8bd401b003 change(matrix_sdk::Room): Return the used EncryptionInfo when sending MessageLike and RawMessageLike events 2025-12-09 18:49:03 +01:00
Stefan Ceriu
b7d22da9f0 change(crypto): provide encryption information back directly from the Olm machine's raw encryption methods 2025-12-09 18:49:03 +01:00
Kévin Commaille
b0574c1c2c feat(sdk): Add support for the stable m.oauth UIAA type
By replacing the custom implementation with the one in Ruma.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-05 09:20:48 +01:00
Damir Jelić
4ea0418abe fix: Don't attempt to serialize custom join rules (#5924)
This is not supported by Ruma. The join_rule field, despite being
defined as a pure string, can have associated data to it based on the
join rule variant.

This means that custom and unknown enum variants might lose data when
reserializing.

Let's just skip the serialization of custom join rules in the RoomInfo,
the concrete value is still available in the state store, it's just not
kept at hand in the RoomInfo.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2025-12-03 16:54:58 +01:00
Kévin Commaille
c1302c417a feat(sdk): Allow to refresh the token in Client::fetch_server_versions
We need to handle 2 possible deadlocks for this:

1. We cannot try to refresh an expired access token if this call happens
   while we are currently trying to refresh the token. The easiest way
   to handle this is to never try to refresh the token when making this
   call inside `get_path_builder_input()` so we implement a "failsafe"
   mode that disables refreshing the access token in case it expired.
   However it attempts the GET /versions again without the token.
2. We cannot access the cached supported versions if we are in the
   process of refreshing that cache because the RwLock has a write lock.
   So if the access token has expired and we try to refresh it, the
   possible calls to `get_path_builder_input()` must not wait for a read
   lock to be available. So the solution is to never wait for a read
   lock, and skip the cache if a read lock is not available.

This also gets rid of workarounds in other functions.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-02 10:51:49 +00:00
Kévin Commaille
be9e7ac9bf test(sdk): Handle more cases with ExpectedAccessToken
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-02 10:51:49 +00:00
Kévin Commaille
bbc6df78ae refactor(sdk): Put ruma-federation-api dependency behind a feature
In theory clients shouldn't make requests to the server-server API. A
way to work around it for this specific case would be to implement
MSC4383.

In the meantime, clients that don't want to use
`Client::server_vendor_info()` won't have to build the extra
dependencies added by ruma-federation-api.

The feature is enabled for the bindings, so it isn't a breaking change
for matrix-sdk-ffi.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-02 11:04:49 +01:00
Kévin Commaille
e47867f232 refactor(sdk): Split supported versions and well-known cache
The supported versions are necessary for querying almost all endpoints,
but after homeserver auto-discovery the well-known info is only
necessary to get the MatrixRTC foci advertised by the homeserver. So it
shouldn't be necessary to always request both at the same time.

Besides:

- Not all clients support MatrixRTC, so they don't need the well-known
  info.
- The well-known info is only supposed to be used for homeserver
  auto-discovery before login. In fact, the MatrixRTC MSC was changed to
  use a new endpoint for this.
- We don't have access to the server name after restoring the Client, so
  the well-known lookup is more likely to fail.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-01 15:22:48 +00:00
Ivan Enderlin
1cf0601ba3 refactor(sdk) Introduce RoomEventCacheStateLock and read/write guards.
This patch extracts fields from `RoomEventCacheState` and move them
into `RoomEventCacheStateLock`. This lock provides 2 methods: `read`
and `write`, respectively to acquire a read-only lock, and a write-only
lock, represented by the `RoomEventCacheStateLockReadGuard` and the
`RoomEventCacheStateLockWriteGuard` types.

All “public” methods on `RoomEventCacheState` now are facade to the read
and write guards.

This refactoring makes the code to compile with the last change in
`EventCacheStore::lock`, which now returns a `EventCacheStoreLockState`.
The next step is to re-load `RoomEventCacheStateLock` when the lock is
dirty! But before doing that, we need this new mechanism to centralise
the management of the store lock.
2025-11-25 15:41:27 +01:00
Damir Jelić
a96485c07a test: Test that we don't end up in a deadlock when fetching the version 2025-10-31 15:58:44 +01:00
Damir Jelić
9680fc3a0f test: Test that the skip_auth option works correctly 2025-10-31 15:58:44 +01:00
Kévin Commaille
8e25c36289 Upgrade Ruma (#5815)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-29 15:02:27 +01:00
Kévin Commaille
547ab31b82 bonus(sdk): Add more profile tests
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-27 10:51:45 +01:00
Kévin Commaille
4ea0b7d984 refactor(sdk): Prefer DELETE HTTP method for profile fields
When it is supported by the homeserver.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-27 10:51:45 +01:00
Kévin Commaille
d2faa1be1a feat(sdk): Add support for deleting custom profile fields
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-27 10:51:45 +01:00
Kévin Commaille
ca0929876f feat(sdk): Add support for setting custom profile fields
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-27 10:51:45 +01:00
Kévin Commaille
c9d3088701 feat(sdk): Add support for fetching custom profile fields
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-27 10:51:45 +01:00
Damir Jelić
3733ee8534 chore: Remove the matrix-sdk-crypto re-export in the matrix-sdk crate 2025-10-24 16:37:15 +02:00
Jorge Martin Espinosa
dcd8aa13f0 fix: NotificationSettings::unmute_room didn't clear the cached notification mode 2025-10-17 12:02:38 +02:00
Benjamin Bouvier
818b1b6000 test(event cache): rewrite the test_redact_touches_thread to make it resilient to races
In the previous version of the thread, the following sequence of events
could happen:

- we subscribe to the thread linked chunk changes
- *then*, the events are being added to the thread linked chunk

This is an edge case where, since we've subscribed to the thread linked
chunk, the thread root will be "known" to be part of a thread, and will
be appended to the thread linked chunk.

If the events happen in the other order (first the events are added to
the thread linked chunk, then we subscribe to the changes), then the
thread root will not be part of the thread linked chunk (because when it
arrived, we didn't know it would be a thread root). As such, the thread
linked chunk state would end up being different in this case.

The solution is to make it so that the thread linked chunk is always
subscribed to *before* any events are added to it. This way, we make
sure that we'll always have the thread root in the thread linked chunk.
2025-10-14 15:37:04 +02:00
Benjamin Bouvier
3705b73256 feat(event cache): when a thread has only redacted replies, remove the thread summary 2025-10-14 15:37:04 +02:00
Benjamin Bouvier
3fb874f901 fix(event cache): also update the thread summary when the redacted event is not the latest one 2025-10-14 15:37:04 +02:00
Benjamin Bouvier
215087f2c1 feat(event cache): have redaction affect thread chunks and summaries
In this initial version, a redaction will:

- *remove* the event from the thread chunk, as does Element Web,
- update the thread summary to reflect the new number of messages in the
  thread, and let us have a thread summary with 0 replies.

A next commit will adapt the code so that a thread summary with 0
replies is removed.
2025-10-14 15:37:04 +02:00
Kévin Commaille
cb3d281f8f Upgrade Ruma after removal of legacy mention push rules
The legacy mention push rules were removed, and the
`contains_display_name` condition was deprecated.

Some tests check for backwards-compatibility with legacy mentions, so we
need to add them back for those tests.

A test with an encrypted event was relying on the legacy mentions, so
the encrypted event was replaced with another one with an intentional
mention.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-09 15:08:38 +01:00
Benjamin Bouvier
44a4ca94be chore: fix new typos 2025-10-06 17:39:23 +02:00
Kévin Commaille
fbafae42bb refactor(tests): Replace uses of EventBuilder::into_raw
We actually want other event formats in those cases, and in most cases
just using `.into()` is enough to generate the proper format.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 15:22:25 +02:00
Kévin Commaille
70b19cc907 refactor(sdk): Use TextMessageEventContent to send a caption
It doesn't make sense to send a formatted caption without a plain text
caption so using TextMessageEventContent forces the latter to be present.

This also allows to use the helpful constructors of
TextMessageEventContent.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-02 08:15:56 +02:00
Benjamin Bouvier
9dc27698dd chore: address new clippy recommendations 2025-09-18 12:01:48 +02:00
Benjamin Bouvier
49d72cd992 chore: run rustfmt after moving to the next edition of matrix-sdk 2025-09-18 12:01:48 +02:00
Valere Fedronic
681863423c feat(rtc): Remove deprecated CallNotify in favour of RtcNotification
`CallNotify` event has been deprecated in favour of `RtcNotification` event https://github.com/ruma/ruma/pull/2199
2025-09-16 16:06:39 +02:00
Valere
0aef2559bd review: Remove unneeded msc4310 feature (consistent with msc4075) 2025-09-06 11:15:49 +02:00
Valere
8606ac3dfb fix typo 2025-09-06 11:15:49 +02:00
Valere
db5503e30e tests: add decline call tests 2025-09-06 11:15:49 +02:00
Valere
c51b4f03a2 misc: clippy fixes 2025-09-06 11:15:49 +02:00
Valere
0fc0a5514d guard test behing feature flag 2025-09-06 11:15:49 +02:00
Valere
e83af1aae2 tests: subscribe_to_call_decline_events 2025-09-06 11:15:49 +02:00
Jorge Martín
6765ca0c39 refactor(sdk): Make Client::server_vendor_info accept an optional request config 2025-09-03 13:18:14 +02:00
Benjamin Bouvier
e89ac3d7df tests: add some sliding sync tests for thread subscriptions and catchup 2025-09-02 14:57:49 +02:00
Benjamin Bouvier
a3704c3563 tests: rearrange some imports ni the sdk/tests/integration/client file 2025-09-02 14:57:49 +02:00
Shrey Patel
68f6d927f1 test(search): Add tests for edits in search index. 2025-09-02 12:25:53 +02:00
Shrey Patel
c3766789cc feat(search): add edits to search index. 2025-09-02 12:25:53 +02:00