Commit Graph

11536 Commits

Author SHA1 Message Date
Ivan Enderlin
e12264bcb6 refactor(sdk): Reduce the size of Error::WrongRoomState.
This patch boxes the error in `Error::WrongRoomState` to reduce the
size of this variant (from 24 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
385df955c3 refactor(sdk): Reduce the size of Error::SlidingSync.
This patch boxes the error in `Error::SlidingSync` to reduce the size of
this variant (from 72 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
47a1db9e16 refactor(sdk): Reduce the size of Error::QrCodeScanError.
This patch boxes the error in `Error::QrCodeScanError` to reduce the
size of this variant (from 72 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
ed82f07d7d refactor(sdk): Reduce the size of Error::EventCacheStore.
This patch boxes the error in `Error::EventCacheStore` to reduce the size of
this variant (from 32 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
4ddd1468c2 refactor(sdk): Reduce the size of Error::StateStore.
This patch boxes the error in `Error::StateStore` to reduce the size of
this variant (from 40 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
b274d36e11 refactor(sdk): Reduce the size of Error::MegolmError.
This patch boxes the error in `Error::MegolmError` to reduce the size of this
variant (from 72 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
7ae82f3afb refactor(sdk): Reduce the size of Error::OlmError.
This patch boxes the error in `Error::OlmError` to reduce the size of this
variant (from 80 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
111306b411 refactor(sdk): Reduce the size of Error::CryptoStoreError.
This patch boxes the error in `Error::CryptoStoreError` to reduce the
size of this variant (from 72 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
c8fb8ad9ca refactor(sdk): Reduce the size of Error::Http.
This patch boxes the error in `Error::Http` to reduce the size of this
variant (from 160 bytes to 16 bytes).
2025-04-04 13:25:55 +02:00
Ivan Enderlin
2f7525c3c8 chore(base): Reduce the size of DependentQueuedRequestKind.
This patch boxes `local_echo` in
`DependentQueuedRequestKind::FinishUpload`, this variant' size is 512
bytes, compared to the second largest variant which is 104 bytes. To
reduce the global size of this enum, `local_echo` is now a `Box<_>`.
2025-04-04 13:25:55 +02:00
Ivan Enderlin
511fc96835 chore(base): Replace iter().any() by contains().
This is usually faster to use `contains()` than `iter().any()` on
a slice.

See https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains.
2025-04-04 13:25:55 +02:00
Ivan Enderlin
cb539bc72b chore(base): Reduce the size of AnySyncOrStrippedState.
This patch reduces the size of `anySyncOrStrippedState`. The `Sync`
variant is 528 bytes, the `Stripped` variant is 232. First off, there is
a non-negligible difference in size between the two, but still, we can
reduce the size of the enum by boxing all values.
2025-04-04 13:25:55 +02:00
Kévin Commaille
2b450a0a6a chore: Add changelog for Client::logout()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-04 13:14:55 +02:00
Kévin Commaille
fc93690d1f test(sdk): Add test for Client::logout()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-04 13:14:55 +02:00
Kévin Commaille
43431b88da feat(sdk): Add Client::logout() to log out regardless of the auth API
It simplifies code for users, and avoids to have to match on
`AuthApi`, which is a non-exhaustive enum.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-04 13:14:55 +02:00
Ivan Enderlin
13ca27d66a chore(cargo): Update eyeball and imbl.
This patch updates `eyeball`, `eyeball-im` and `eyeball-im-util` from
`main` branch to latest releases.

This patch also updates `imbl` to 5.0.
2025-04-04 10:09:12 +02:00
Stefan Ceriu
9f7179263a fix(ffi): correctly populate all audio content fields when converting from FFI types to Ruma
- fixes forwarding audio and voice messages that would previously show up as files because of missing fields
2025-04-03 15:50:17 +03:00
Kévin Commaille
c8da9cb462 refactor(oauth): Remove the issuer from OAuthAuthData
It is actually unused, and now that we only need homeserver URLs for
static registrations, users don't need to access it easily.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-03 12:52:17 +03:00
Kévin Commaille
678938951e chore: Update changelog for OAuthRegistrationStore removal
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-03 12:52:17 +03:00
Kévin Commaille
8883e081af refactor(oauth): Remove OAuthRegistrationStore
MSC2966 was updated, clients should re-register for every log in, so we
don't need to store the client IDs between logins.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-04-03 12:52:17 +03:00
Johannes Marbach
c4d9ec98c3 feat!(ffi): merge send_reply and send_thread_reply (#4880)
This pushes down the `Reply` struct to be provided when sending a reply, and merges the `send_reply` and `send_thread_reply` FFI functions.

This is a small follow-up on https://github.com/matrix-org/matrix-rust-sdk/pull/4852/files#r2016594024.

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-04-03 11:19:21 +02:00
Johannes Marbach
dccd836dc6 feat!(timeline): allow sending media as (thread) replies (#4852)
This makes it possible to reply with a media, as part of a thread or not.

Fixes #4835.

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-04-02 12:25:06 +00:00
Benjamin Bouvier
c719cd11f3 fix(event cache): properly clear all rooms, including those sleeping in the store backend 2025-04-02 13:54:43 +02:00
Benjamin Bouvier
42133a60c8 fix(ffi): use EventCache::clear_all_rooms() to clear the events caches
Clearing only the store backend, while not emptying the in-memory linked
chunks, will lead to out-of-sync state across the in-memory caches and
the database. As a result, it's safer to call the existing
`EventCacheInner::clear_all_rooms`, which will clear all the rooms
manually.
2025-04-02 13:54:43 +02:00
Benjamin Bouvier
d30dc7177f refactor(sqlite): rename gaps to gap_chunks / events_chunks to event_chunks
And some comments have been tweaked too.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
e42be87798 test(event cache): add tests for save_event() and find_event_relations()
And fix the sql backend \o/
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
524040b33c refactor(event cache): have EventCacheStore::clear_all_rooms_chunks delete all the events' contents 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
0227b3f554 refactor(event cache): regroup code to compute the filter strings 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
6a076b0989 refactor(event cache): don't return the event itself, in find_event_with_relations
And rename it `find_event_relations`.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
9b1a5b7102 refactor(event cache): don't have find_event_with_relations return redaction events
A redaction event would be either applied a priori (by the server, when
returning the sync response), or the event cache would handle it, and
redact it in the database; in any case, we'd never see the original
event in its non-redacted form, so there's no point in returning the
redaction event itself.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
0bb72064b5 refactor(event cache): don't have find_event_with_relations return replies
It's unclear whether it's useful, especially in the case where it would
return an entire reply chain. It's not possible to filter in replies
only, using the function either, which is a sign that replies shouldn't
be indexed, IMO. In any case, that's something we can add back in the
future, if we want to.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
8af68d7389 feat(event cache): get the transitive closure of related events when getting an event's relations 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
cde0a9e24b refactor(event cache): get rid of the AllEventsCache 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
9423e41a06 refactor(event cache): use the store methods to retrieve an event by id, with or without its relations 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
3489cbd5d7 feat(event cache): allow retrieving an event and all its relations 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
65be779bb0 refactor(event cache): move relation extraction into common store helpers 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
45f1dca6a3 refactor(event cache): don't return a position in find_event
Getting the position when reading an event is no longer required:

- the only use case for reading the position out of the event cache was
when we wanted to replace a redacted item into the linked chunk; now
with save_event(), we can replace it without having to know its
position.

As an extra measure of caution, I've also included the room_id in the
`events` table, next to the event_id, so that looking for an event is
still restricted to a single room.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
913b2a5f78 feat(event cache): allow to persist an out-of-band event into storage 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
627e2ca5a6 refactor(linked chunk): rejigger the relational linked chunk so it can handle indexed items
This is necessary to save out-of-band items into the relational linked
chunk. I'm not quite sure of the value to keep it generic, at this
point, but at least it makes testing easy.
2025-04-02 13:26:15 +02:00
Benjamin Bouvier
3d8af1b972 feat(event cache): extract an event's relationship before inserting it into the database 2025-04-02 13:26:15 +02:00
Benjamin Bouvier
03f5d0222e refactor(event cache): store the events' content independently of their position in a chunk 2025-04-02 13:26:15 +02:00
dependabot[bot]
af85447328 chore(deps): bump tj-actions/changed-files
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 0fee5fb278312d962ff465bb38dc4cae9f446de2 to 27ae6b33eaed7bf87272fdeb9f1c54f9facc9d99.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](0fee5fb278...27ae6b33ea)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-02 09:07:21 +02:00
Andy Balaam
d34e11b9f6 Fixes #4871 (hopefully). In test code, sync after other user cross-signs 2025-04-01 14:56:13 +02:00
Benjamin Bouvier
231073c9c3 chore(sqlite): log underlying errors in many OpenStoreError variants
This would help understanding what's the underlying error each time.
2025-04-01 14:51:32 +02:00
Andy Balaam
34a3fb4efb Fix typo decodeable -> decodable 2025-04-01 12:07:29 +01:00
dependabot[bot]
a38c3b5dc5 chore(deps): bump crate-ci/typos from 1.30.2 to 1.31.1
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.30.2 to 1.31.1.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.30.2...v1.31.1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-01 12:07:29 +01:00
Ivan Enderlin
1a1310e205 doc(ffi,sqlite,sdk): Update CHANGELOG.mds. 2025-04-01 11:50:20 +02:00
Ivan Enderlin
d7b6fae2a3 feat(ffi): Add session_pool_max_size, …_cache_size and …_journal_size_limit.
This patch adds 3 methods on `ClientBuilder`:

1. `session_pool_max_size`,
2. `session_cache_size`,
3. `session_journal_size_limit`.

Respective fields are also added.

These values control the `SqliteStoreConfig`, used to control the
stores, especially their memory consumption.
2025-04-01 11:50:20 +02:00
Ivan Enderlin
bb87a728ac doc(sqlite): Fix a broken link. 2025-04-01 11:50:20 +02:00
Ivan Enderlin
d60810c2af refactor(ffi): Rename ClientBuilder::passphrase to session_passphrase.
This patch renames the `passphrase` method of `ClientBuilder` to
`session_passphrase` for more consistency with the `session_paths`
method.
2025-04-01 11:50:20 +02:00