Commit Graph

13223 Commits

Author SHA1 Message Date
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
Ivan Enderlin
a6a4579ef9 feat(sdk): Add ClientBuilder::sqlite_store_with_config_and_cache_path.
This patch a new `sqlite_store_with_config_and_cache_path` method on
`ClientBuilder`.
2025-04-01 11:50:20 +02:00
Ivan Enderlin
a084a5b08b feat(sdk): BuilderStoreConfig::Sqlite embeds SqliteStoreConfig.
This patch removes the `path` and `passphrase` fields from
`BuilderStoreConfig::Sqlite`, and replaces them by `SqliteStoreConfig`.

This patch then opens the stores with `open_with_config` instead of
`open`.
2025-04-01 11:50:20 +02:00
Ivan Enderlin
4112162092 feat(sqlite): Add SqliteStoreConfig::path() to override the path.
This patch adds `SqliteStoreConfig::path()` to override the path passed
to the constructor `new`.
2025-04-01 11:50:20 +02:00
Ivan Enderlin
f341572616 feat(sqlite): SqliteStoreConfig implements Clone and Debug.
This patch implements `Clone` and `Debug` for `SqliteStoreConfig`.
2025-04-01 11:50:20 +02:00
Ivan Enderlin
a047784278 feat(ffi): Add Client::restore_session_with and RoomLoadSettings.
This patch adds `Client::restore_session_with` along with the
`RoomLoadSettings` enum.
2025-04-01 10:50:18 +02:00
Ivan Enderlin
7ac3fa1f4a refactor(ffi): Inline restore_session_inner.
This patch inlines the `restore_session_inner` into its unique call
site.
2025-04-01 10:50:18 +02:00
Kevin Boos
c30ec0ed8a chore(sdk): Reduce log verbosity from info -> trace in a few functions (#4747)
At the default `INFO` log level, the log gets inundated with thousands
of emitted statements, primarily related to
`is_display_name_ambiguous()`. The execution of this tiny function
certainly doesn't need to be traced every time, at least not at the info
log level.

Note: some of these could be debatably reduced to debug level rather
than trace level, but I went with "trace" because they all seem to be
trace statements rather than actual debug dump outputs (there is no
actual program state dumped out).

Signed-off-by: Kevin Boos
[kevinaboos@gmail.com](mailto:kevinaboos@gmail.com)

---------

Signed-off-by: Kevin Boos <1139460+kevinaboos@users.noreply.github.com>
2025-03-31 15:11:06 +00:00
Ivan Enderlin
d6f2fd4304 test(base): Test BaseStateStore::load_rooms.
This patch adds tests for `BaseStateStore::load_rooms`. This patch also
updates the `test_derive_from_other` test.
2025-03-31 16:47:58 +02:00
Ivan Enderlin
cf5b8d3b33 test(base): Test StateStore::get_room_infos with the RoomLoadSettings arguments.
This patch tests the new behaviour of `StateStore::get_room_infos`.
2025-03-31 16:47:58 +02:00
Ivan Enderlin
2a67d7472a feat(base,sqlite,indexeddb): Use RoomLoadSettings to load all or one room.
This patch updates `BaseStateStore` and the `StateStore` trait along
with its implementors, to return all rooms or a single room from
`StateStore::get_room_infos`.

See the previous patch for more context.
2025-03-31 16:47:58 +02:00
Ivan Enderlin
9f74be26c3 feat(base): Introduce RoomLoadSettings.
This patch introduces the `RoomLoadSettings` enum. It is helpful to load
either all rooms or one room when activating a `BaseClient`, i.e. when a
session is initialized or restored.

It addresses a broader problem where, for large accounts with large
caches, creating a `BaseClient` takes many resources. In a resource
constrainted context, like a push notification process, it can eat all
resources up to the point the process is killed (then notifications can
be missed).

The idea is then to force the `BaseClient` to load a single room.

This patch installs the `RoomLoadSettings` argument everywhere it needs
to be. The next patch will use `RoomLoadSettings` to load either all
rooms or a single one.
2025-03-31 16:47:58 +02:00
Damir Jelić
fb04539418 refactor(encryption): Simplify the parsing of OAuthCrossSigningResetInfo
Now that OAuth isn't behind a feature flag a bunch of things can be
simplified.

Seems that we don't need a Client object either.
2025-03-31 13:06:28 +02:00
Richard van der Hoff
192cf0154a integration-test: Remove postgres container (#4858)
Followup on https://github.com/matrix-org/matrix-rust-sdk/pull/3983: now
that we don't have a sliding sync proxy, we don't need a postgres
container.
2025-03-28 16:51:12 +00:00