Commit Graph

11986 Commits

Author SHA1 Message Date
Ivan Enderlin
0c193500d2 refactor(sdk): Remove SlidingSyncRoom \o/.
This patch FINALLY removes `SlidingSyncRoom`, youhou!
2025-05-19 15:58:58 +02:00
Ivan Enderlin
6c68cef6e0 refactor(sdk): Remove SlidingSync::rooms.
This patch removes the `SlidingSync::rooms` field. A cascade of removal
happens, and many part of the code is simplified. The most notable is
`FrozenSlidingSync`.
2025-05-19 15:58:58 +02:00
Ivan Enderlin
5a7a42cde3 refactor(sdk): Stop maintaining SlidingSync::rooms.
This patch stops maintaining/updating `SlidingSync::rooms`. The goal is
to remove `SlidingSyncRoom`.
2025-05-19 15:58:58 +02:00
Ivan Enderlin
0ad88842cc refactor(sdk): Remove SlidingSync::get_rooms and get_all_rooms.
This patch removes `SlidingSync::get_rooms` and `get_all_rooms`. The
goal is to remove `SlidingSyncRoom`.
2025-05-19 15:58:58 +02:00
Ivan Enderlin
7c0f7f4715 refactor(sdk): Remove SlidingSync::get_number_of_rooms.
This patch removes `SlidingSync::get_number_of_rooms`. The goal is to
remove `SlidingSyncRoom`.
2025-05-19 15:58:58 +02:00
Ivan Enderlin
52c38ec44d refactor(base): Remove SlidingSync::get_room.
This patch removes the `SlidingSync::get_room` method. The goal is to
remove `SlidingSyncRoom`.
2025-05-19 15:58:58 +02:00
Valere Fedronic
21de891ea5 feat(sdk): Add the encrypt_and_send_raw_to_device method
This method allows users to encrypt and send custom to-device events to a set of devices of their choosing.
matrix-sdk-ffi/20250521
2025-05-19 11:20:25 +00:00
Mauro
154f29e5a0 feat(sdk): implement and observe MSC4278 config value
This patch
- Updates Ruma to use the improved MediaPreviewConfig event type that
also supports a `Default` for the content type
- Implemented a way to observe the stable and unstable values of the
event and return the used one accordingly, if no one is present the
default will be used
- Set the value (will only use unstable type for now)
2025-05-19 12:35:50 +02:00
Ivan Enderlin
7f07731471 doc(changelog): Add #5054. 2025-05-19 11:42:09 +02:00
Ivan Enderlin
1a0a4d7905 chore(base): Remove RoomInfo::prev_room_state.
This patch removes the `RoomInfo::prev_room_state` field, along with the
`RoomInfo::prev_state` method.

This data was introduced during the knocking project but was never used,
and is not used nowadays. Let's remove it.
2025-05-19 11:42:09 +02:00
Jonas Platte
e3bcd4d5b2 chore: Upgrade dirs to 6.0 in examples 2025-05-19 09:23:02 +02:00
Timo
ea4c9a41f8 feat(widgets): Add the controlledMediaOutput url parameter to the VirtualElementCallWidgetOptions.
This is used to configure EC on devices that need to control media outputs on their own (android, ios).
If set, EC will display a list of devices provided by the app.
2025-05-16 15:48:49 +02:00
Ivan Enderlin
ac2c7f431c feat(ui): Add m.room.tombstone to the room list required_state.
This patch adds the `m.room.tombstone` state event to the list of
events in `required_state` used by the `RoomListService`. The goal is to
offer the possibility for the consumers to know whether a room has been
tombstoned or not.
2025-05-16 15:11:11 +02:00
Ivan Enderlin
c0d6e87c99 task(base): Fix conflicts with a previous patch. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
6162600bda refactor(base): Remove &mut Context argument from response processors when unused.
This patch removes the `_context: &mut Context` argument from response
processors when it's unused.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
1187539ea4 chore(base): Remove the useless PreviousEventsProvider. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
2649587d2f refactor(sdk): Use the Event Cache for read_receipts::compute_unread_counts.
The `read_receipts::compute_unread_counts` function needs the _previous
events_ to compute the read receipt correctly. These previous events
were store in `SlidingSyncRoom::timeline_queue`. Since the removal of
`timeline_queue` in the previous patches, this patch uses the Event
Cache to fetch them. It only uses events that are loaded in memory.
This is as correct as the prior behaviour, even this is still incorrect
since it doesn't back-paginate to get a better view. This is for
later. The goal of this patch is to restore the same behaviour, without
`timeline_queue`.

The main problem is that read receipts are computed in
`matrix-sdk-base`, and that the Event Cache lives in `matrix-sdk`. Thus,
we change the `SlidingSyncResponseProcessor` to handle read receipt
in particular.

The
`matrix_sdk_base::response_processors::rooms::msc4186::extensions::dispa
tch_ephemeral_events` function has been split in
two methods `dispatch_typing_ephemeral_events`, and
`dispatch_receipt_ephemeral_event_for_room`. The workflow has been a
little bit redesigned to fit in the new `SlidingSyncResponseProcessor`
constraints.

This patch moves one test from `matrix-sdk-base` into `matrix-sdk`,
because to compute the read receipt, the Event Cache must be
enabled/listening to sync updates.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
68651aac1f feat(sdk): Add RoomEventCache::events to avoid ::subscribe.
`RoomEventCache::subscribe` returns the set of events + the
`RoomEventCacheListener`. However, creating this listener isn't
cheap, especially dropping it. That's why this patch creates
`RoomEventCache::events` to replace `subscribe` when the listener is
not necessary.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
2c8f48fabb doc(base): Fix inline comment typos. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
c426c03624 refactor(sdk): Remove timeline and prev_batch from SlidingSyncRoom. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
eeaa091024 chore(ffi): Justify the allow(clippy::large_enum_variant). 2025-05-16 14:27:49 +02:00
Ivan Enderlin
7ef962f931 chore(labs): Allow clippy::large_enum_variant in multiverse.
This is development-, debug-oriented tool. Let's allow
`clippy::large_enum_variant` for the moment.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
8480e0fc55 chore(ui): Allow clippy::large_enum_variant on TimelineAction.
This enum is large, but it's used in a short period of time, not
collected somewhere, so it's safe to accept a large size here.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
bf5e0124ab refactor(ui): Reduce the size of NotificationEvent.
This patch reduces the size of `NotificationEvent` from 576 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
d56ad64cc2 refactor(ui): Reduce the size of NotificationStatus.
This patch reduces the size of `NotificationStatus` from 216 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
ab3f22c212 refactor(sdk): Reduce the output size of get_header.
This patch reduces the size of the output's `Result::Err` variant of
`get_header` from 160 bytes to 8 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
e41dbd6300 refactor(sdk): Reduce size of HttpError.
This patch reduces the size of `HttpError` from 160 bytes to 24 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
29a8556f10 refactor(sdk): Reduce size of ReplyContent.
This patch reduces the size of `ReplyContent` from 448 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
8d0d920808 refactor(sdk): Replace iter().any() by contains().
This is faster for scalars, but it falls back to a regualar
`iter().any()` for other types. It's the same, but at least Clippy
doesn't complain.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
1cdc9ff6e4 refactor(sdk): Use IoError::other.
This patch replaces `IoError::new(IoErrorKind::Other, …)` by
`IoError::other(…)`.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
9541123fcf refactor(crypto): Reduce the size of SasState.
This patch reduces the size of `SasState` from 288 bytes to 88 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
ed4b789f87 refactor(crypto): Reduce the size of OutgoingContent.
This patch reduces the size of `OutgoingContent` from 160 bytes to
24 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
18a3c37554 refactor(crypto): Reduce sizes of Verification and VerificationRequestState.
This patch reduces the sizes of `Verification` from 376 bytes to
16 bytes, and `VerificationRequestState` from 424 bytes to 96 bytes.

It also reduces the size of a couple of other types in the same vain.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
92b4b03a8d refactor(crypto): Reduce the size of OutgoingContent and RoomMessageRequest.
This patch reduces the sizes of `OutgoingContent` from 464 bytes to
160 bytes, and `RoomMessageRequest` from 480 bytes to 40 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
192c50dcad refactor(crypto): Reduce the size of OutgoingVerificationRequest.
This patch reduces the size of `OutgoingVerificationRequest` from
480 bytes to 64 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
7b34eaabe5 refactor(crypto): Reduce the size of AnyOutgoingRequest.
This patch reduces the size of `AnyOutgoingRequest` from 488 bytes to
72 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
2eb4278835 refactor(crypto): Reduce the size of RoomIdentityChange.
This patch reduces the size of `RoomIdentityChange` from 576 bytes to
72 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
293d4ee08c refactor(crypto): Reduce the size of MaybeEncryptedRoomKey.
This patch reduces the size of `MaybeEncryptedRoomKey` from 336 bytes
to 32 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
87066a127e refactor(crypto): Use IoError::other.
This patch uses `IoError::other(…)` as a shortcut of
`IoError::new(ErrorKind::Other, …)`.
2025-05-16 14:27:49 +02:00
Kévin Commaille
4847a3135b feat(base-sdk): Ignore marked_unread room account data with unstable prefix after seeing one with stable prefix
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-16 09:55:02 +02:00
Kévin Commaille
af02e0c472 feat(sdk): Send stable m.marked_unread room account data
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-16 09:55:02 +02:00
Stefan Ceriu
da2dda0e45 fix(ui): populate the thread_root and in_reply_to fields for stickers and polls
They have never been set and there was no way of telling if stickers and polls belong on a thread or come in reply of any other message.

This patch also exposes methods for setting these relations on the event factory level.
2025-05-15 16:45:34 +03:00
Benjamin Bouvier
69b8878890 fix(sdk): mark rooms joined with join_room_by_id or join_room_by_id_or_alias as DMs if needs be
This moves the logic from `Room::join()` to these two methods. This is
isofunctional, because `Room::join()` does call into
`Client::join_room_by_id()` internally.
2025-05-15 14:19:31 +02:00
Damir Jelić
7893e55a8d refactor(crypto): Make the room key importing logic more generic 2025-05-15 12:23:23 +02:00
Damir Jelić
c0e45a2e0f refactor(widgets): Rename the then() function into add_response_handler() (#5037)
The then() function can be used with booleans and futures to execute a
piece of code if the boolean is true or once the future is completed.

In contrast, the then() function in the widget driver is not executed
immediately. Instead it only adds a callback that is later on executed
by the widget driver.
2025-05-14 16:16:04 +02:00
Stefan Ceriu
13a65c8dfe feat(ui): add new Thread timeline focus mode and associated events loader (#5032)
… that allows building a timeline instance specific to a particular
thread root.

Creating a timeline in this mode will start by backpaginating root event
relations with `num_events` and automatically insert the thread root
event when reaching the end. It will include
`RelationsOfType(RelationType::Thread)` but also recurse over the
retrieved events to fetch reactions.
It will not however react to new events received over sync or that the
user sends (for now).

This patch will also help incrementally deliver the upstream client
support for creating such a timeline.

Part of #4833 (meta #4869).
2025-05-14 14:14:29 +00:00
Kévin Commaille
36667c1298 chore: Get rid of cargo-deny errors due to new advisories
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-14 15:42:46 +02:00
Benjamin Bouvier
e4f2299785 refactor(timeline): get rid of FullEventMeta and replace it with EventMeta + function parameters 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
81a2679bb8 refactor(timeline): only compute the TimelineEventContext when it's needed 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
9087263da4 refactor(timeline): rewrite how failed-to-parse items are added 2025-05-14 13:30:24 +02:00