Commit Graph

4339 Commits

Author SHA1 Message Date
Benjamin Bouvier
f3b9a01904 refactor(event cache): rename the read_lock_acquisition mutex 2026-02-04 16:24:23 +01:00
Benjamin Bouvier
2fb5a32db2 refactor(event cache): rename RoomEventCacheStateLockInner to RoomEventCacheState
There was nothing called `RoomEventCacheState` anymore, and the `Inner`
suffix is dubious, at best. Also, we can get rid of the `Lock`
component, since indeed it's locked, but it's a detail from the point of
view of the `RoomEventCacheState` itself. This makes for a shorter and
nicer name.
2026-02-04 16:24:23 +01:00
Jorge Martín
70dd02012b fix(ffi): Don't override the default package_name and cdylib_name values for Kotlin bindings
Otherwise, the bindings expect the generated JAR/AAR files to contain separate `.so` libraries for each crate
2026-02-04 10:53:29 +01:00
Jorge Martín
7ffcf72483 fix(ffi): Remove UniFFI checksums in matrix-sdk crate
This was forgotten in a previous PR about removing the checksums for all crates exporting bindings.
2026-02-04 10:23:16 +01:00
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
Benjamin Bouvier
1152eb6d37 refactor(room): move PinnedEventsRoom::load_event_with_relations to the Room object
The method is kept on the pinned loader trait at the moment, because
it's too inconvenient to remove it quite yet. This will happen in a
subsequent PR.
2026-02-04 09:39:18 +01:00
dependabot[bot]
f270eda75d chore(deps): bump bytes from 1.11.0 to 1.11.1
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-version: 1.11.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-04 10:23:35 +02:00
Benjamin Bouvier
40c6c330b0 chore(typos): fix new typos 2026-02-02 18:36:01 +01:00
Benjamin Bouvier
19234abf32 review(task_monitor): address comments, watchdog -> task_monitor, misc doc adjustments and renamings 2026-02-02 16:13:00 +01:00
Benjamin Bouvier
50b06e8e5b feat(ffi): add support for listening to background jobs errors 2026-02-02 16:13:00 +01:00
Benjamin Bouvier
3d5679954b refactor(event cache): use the task monitor for event cache long-running jobs 2026-02-02 16:13:00 +01:00
Benjamin Bouvier
561b04cab0 feat(client): have the Client hold one task monitor 2026-02-02 16:13:00 +01:00
Nashwan Azhari
cb9690ecba doc: change matrix.org/docs/spec links to spec.matrix.org 2026-02-02 10:24:11 +01:00
Damir Jelić
2f7887d607 refactor(auth): Change the secure channel methods to operate more on strings
This will come in handy once we attempt to support MSC4388 as this MSC
changes how the client-server API operates. The rendezvous channel will
in the future operate on JSON messages where we'll include our sealed
ciphertext as a base64 encoded string.
2026-01-30 17:14:05 +01:00
Damir Jelić
837590d90e refactor(auth): Move the MSC4108-specific rendezvous channel implementation into a submodule 2026-01-30 17:14:05 +01:00
Damir Jelić
94bc870686 refactor(qr-login): Create a submodule for the rendezvous channel 2026-01-30 17:14:05 +01:00
Damir Jelić
911b559113 feat(crypto): Add support for the QR code data type defined in MSC4388 2026-01-30 16:37:17 +01:00
Ivan Enderlin
2ffe003136 doc(sdk) Add #6056 to the CHANGELOG.md. 2026-01-30 15:34:48 +01:00
Ivan Enderlin
1dc1d2a3f0 feat(sdk): Add LatestEventValue::RemoteInvite.
This patch adds the `LatestEventValue::RemoteInvite` variant. The goal
of this is to be able to compute a `LatestEventValue` for an invite to
a room. Using `LatestEventValue::Remote` isn't possible because it's
usually built from the `RoomEventCache`. However, the `EventCache`
doesn't handle invites for one reason: invites only manipulate stripped
state-events, whist the `EventCache` manipulates non-stripped (state)
events.

The `LatestEvents` API receives a stream of `RoomInfoNotableUpdate`. It
reacts to update from the `RoomInfo`. It filters out all reasons except
`MEMBERSHIP`. When the `MEMBERSHIP` is updated, and the room' state is
`Invited`, then a `RemoteInvite` is computed.

The `Invite` type is updated to include the `inviter_id` in case the
`inviter` is missing. Indeed, we always know the user ID of the inviter,
this information isn't optional.
2026-01-30 15:34:48 +01:00
Ivan Enderlin
21448ab874 fix(sdk): Skip updates for missing rooms only.
This patch skips updates for missing rooms only, i.e. it doesn't early
return and then miss all other rooms.
2026-01-30 15:34:48 +01:00
Damir Jelić
b03c482c95 refactor(crypto): Remove the rendezvous_url method from the QrCode data type
MSC4388 won't have the full rendezvous URL encoded in the QR code,
instead it'll have a rendezvous ID.

So let's remove this accessors and use the `intent_data()` getter
instead.

MSC4388: https://github.com/matrix-org/matrix-spec-proposals/pull/4388
2026-01-30 10:19:46 +01:00
Damir Jelić
c4a04eee97 refactor(crypto): Create a MSC and intent specific accessor for the QR login data type
This patch adds a view into the MSC-specific and intent specific data
fields of the QR login data type.

MSC4108 and MSC4388 have subtle differences in the way the rendezvous
URL and the server name are shared, this new getter allows us to access
all of those fields in a consistent manner.

MSC4108: https://github.com/matrix-org/matrix-spec-proposals/pull/4108
MSC4388: https://github.com/matrix-org/matrix-spec-proposals/pull/4388
2026-01-30 10:19:46 +01:00
Damir Jelić
036fa5ca82 refactor(crypto): Rename QrCodeModeData into QrCodeIntentData 2026-01-30 10:19:46 +01:00
Damir Jelić
90651a3067 refactor(crypto): Rename QrCodeMode into QRCodeIntent 2026-01-30 10:19:46 +01:00
Damir Jelić
38731f12de refactor(crypto): Abstract away QrLoginData so we can support multiple MSC versions
This patch modifies the QrLoginData, it now hides all its public fields
and appropriate getters have been created for it instead.

This is necessary to hide the MSC specific parts of the data type thus
allowing support of multiple versions of the data type.
2026-01-30 10:19:46 +01:00
Damir Jelić
4e7b77d7d0 refactor(qr-login): Attempt to export the secrets bundle sooner in the login process
This ensures that, if we don't have a valid secrets bundle at hand we
error out as early es possible.
2026-01-30 10:15:26 +01:00
Tobias Fella
225644111c docs(sdk): Fix grammar 2026-01-29 14:18:18 +01:00
Jonas Platte
fccf44f285 fix: Add 'bellow' as a forbidden word (#6073)
Signed-off-by: Jonas Platte
2026-01-27 10:53:07 +00:00
Benjamin Bouvier
9f093737c4 doc(r2d2): tweak links and fix a few typos in the doc comment of r2d2 2026-01-27 11:27:12 +01:00
Benjamin Bouvier
ae428446f9 test(http client): make the test_retry_limit_http_requests test more resilient
This test was setting a client-wide retry limit of 3 attempts for every
single network request. It happens that it was using the login method,
which unconditionally overrides this retry limit to 3 anyways, in
`LoginBuilder::send()`, so it worked only because the two retry limits
were accidentally in sync. Changing the retry limit in the test to 4
would make it thus fail; the test has been changed so it tries to use
the /whoami endpoint instead of login, as the former doesn't override
the retry limit.
2026-01-27 10:58:02 +01:00
Benjamin Bouvier
d099239427 chore(http client): rename a variable to make it clearer what its role is
The `default_timeout` is a timeout value provided by `backon`, and
that's a suggestion of what the timeout value should be for the next
request (based on the backoff method used under the hood — in our case,
the exponential backoff). Since we have another concept of a default
timeout (the one present in the RequestConfig), it seems better to call
the timeout suggested by backon in a different manner, that's more
explicit in the given context.
2026-01-27 10:58:02 +01:00
Jorge Martín
19724cf2c2 fix(sdk): Fix latest event erasing RoomInfo
The sync lock was acquired too late in `LatestEvent::store`, which could lead to a race condition where we read some room info, that room info was modified and saved in parallel somewhere else, and then we modified the copy of the room info and overwrote that saved data with it, resulting in data loss.

In the clients, this was experienced as notifications sometimes lacking the room display name
2026-01-27 09:08:59 +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
Kévin Commaille
e77e2ae18f fix(base): Handle sync state events that fail to deserialize
If the homeserver provides a state event to a client, it means that it
considers the event to be valid. If a state event is valid, it always
updates the state map of the room. So ignoring events that fail to
deserialize means that the local state map is different than the one
from the server.

In some cases the Matrix spec even explicitly says that if a required
field is missing from the content of a state event, it should be treated
as if the event is missing from the state map. And if a required field
is missing, the event will fail to deserialize.

So this handles state events very closely to how a server would we only
deserialize the event type and the state key first to make sure that a
valid state event always updates the local state map. Then we only
deserialize the events lazily when we encounter an event type that
updates the `RoomInfo`. Because we deserialize the event lazily and some
methods might edit parts of an event before passing it to `RoomInfo`,
the (possibly edited) deserialized event is cached alongside the raw
event and its keys to be able to pass it further down the chain.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Ivan Enderlin
9cf649eb60 fix(sdk): EventCacheInner::by_room can be a HashMap.
This patch replaces `HashMap` by `BTreeMap` in `EventCacheInner` as
we don't need any ordering. It is then faster to get (or insert) a new
`RoomEventCache`:

- an insert is O(1) for `HashMap` vs. O(log(n)) for `BTreeMap`,
- a get is O(1) for `HashMap` vs. O(log(n)) for `BTreeMap`.
2026-01-23 16:17:54 +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
3b339be422 refactor(media): remove the now unused make_local_thumbnail_media_request 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
b3aa849f87 feat(sdk): New state event candidate for LatestEventValue: m.room.member with join.
This patch adds a new state event candidate for `LatestEventValue`:
`m.room.member` when the `membership` is `join` and the `state_key`
is the current user ID. Put differently: when the current user joins a
room, we are able to compute a `LatestEventValue`.
2026-01-20 14:43:18 +01:00
Michael Goldenberg
d1c8b1090b fix(sdk): ensure IdentityStatusChanges not dropped prematurely
For details, see https://github.com/matrix-org/matrix-rust-sdk/issues/4599

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-01-19 09:32:15 +01:00
Skye Elliot
90390d7488 Merge pull request #6017 from matrix-org/kaylendog/history-sharing/backup-download
feat: Download room keys from backup before building key bundle.
2026-01-16 17:03:46 +00:00
Benjamin Bouvier
5b8ff8a76d refactor(state store): remove StateStore::upsert_thread_subscription
There is `StateStore::upsert_thread_subscriptions` as a proper
replacement these days.
2026-01-16 17:01:03 +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
Ivan Enderlin
34ef8fc324 fix(sdk): The LatestEventValue is erased when a room has been emptied.
This patch ensures that a `LatestEventValue` is erased when a room has
been emptied.

If we are computing a value from the Event Cache, it's because we
have received an update from the Event Cache. This update falls in two
categories: either an event has been added or updated, or the room has
been emptied. We consider the room has been emptied by default. If we
are able to scan at least one in-memory event, we consider the room has
not been emptied.

This patch adds one specific, and updates other tests that were using
an empty Event Cache (which now produces a different result in this
situation).
2026-01-16 15:01:52 +01:00
Ivan Enderlin
92a7d033a2 chore(sdk): Split latest_events::latest_event.
This patch splits the `latest_events/latest_event.rs`
module into `latest_events/latest_event/mod.rs` and
`latest_events/latest_event/builder.rs`. The file was too big and asked
for a diet. The `LatestEventValueBuilder` type has been renamed to
`Builder`, and the `LatestEventVAluesForLocalEvents` has been renamed
to `BufferOfValuesForLocalEvents` for the sake of clarity and shorter
names.
2026-01-16 14:37:46 +01:00
mlm-games
cb8a9995ac fix(widget): Do not include uniffi attrs when the feature is not enabled for element_call.rs 2026-01-16 14:19:16 +01:00
Skye Elliot
8a89726726 docs: Update CHANGELOGs. 2026-01-16 11:44:45 +00: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
3baaef5109 feat: Download room keys from backup before building key bundle.
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-01-13 15:19:28 +00:00
Ivan Enderlin
11d430563b doc(sdk): Update the `CHANGELOG.md. 2026-01-13 13:26:16 +01:00