Commit Graph

12013 Commits

Author SHA1 Message Date
Benjamin Bouvier
4fd0f2a32c refactor(timeline): slightly optimize flow for saving a bundled edit
We only need the edit_json if we're about to save the edit aggregation.
Likewise, if there's no current event id (i.e. the event being handled
is a local echo), then we don't need to even try to extract anything
from the bundle information.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
74d5d6e265 refactor(timeline): group extracting the reply and thread root
The poll events's `related_to` field is a `RelationWithoutReplacement`,
while the two others are `Relation<C>`, where `C` is the event content
type (in case it was replacement). As a matter of fact, we try
converting the `Relation<C>` into a `RelationWithoutReplacement` (which
unfortunately requires cloning, which is wasteful if the relation was a
replacement indeed), and then we can use a single function to extract
the reply information and thread root info, for all three.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
caa53be00e optimize(timeline): find the position of an event by starting from the end 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
b3086accd5 refactor(timeline): hey, i can actually remove this pending_edits field now 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
f010587201 chore: make clippy happy
bleh.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
2af751d8c6 optimize(timeline): avoid one clone if a new item has pending aggregations 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
f36f9915d1 refactor(timeline): simplify a few functions as a result of not providing the edit json ahead of time 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
e8f8e7bfd6 fix(timeline): properly update encryption info upon edit
To be fair, this is a regression from a previous commit in this PR.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
dbe23777a0 refactor(timeline): use the aggregations manager for handling edits 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
b7191e3dc2 refactor(timeline): have Aggregations::try_remove_aggregation also take care of updating the item 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
56ce93ce72 refactor(timeline): simplify a bit mark_aggregation_as_sent by having it do more work
This avoids another struct definition, and items are going to be needed
for edits anyways.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
9cbc674cf2 optimize(timeline): don't eagerly clone an EventTimelineItem before applying an aggregation onto it 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
16fe53c40d refactor!(timeline): have TimelineItem::reactions() return an Option<&ReactionsByKeyBySender> instead of owned non-optional 2025-05-20 13:50:02 +02:00
Benjamin Bouvier
1b581d52e8 refactor(timeline): rename Aggregations::apply to Aggregations::apply_all
It applies *all* the stashed aggregations for a given event timeline
item.
2025-05-20 13:50:02 +02:00
Benjamin Bouvier
dd6604e9f3 feat(timeline): handle redaction in the pending aggregations
This allows having a redaction event come before the related event, and
still handle it when the redacted event shows up.
2025-05-20 13:50:02 +02:00
Yousef Moazzam
f173510482 test: Replace sync_timeline_event! with EventFactory for beacon events in room integration tests 2025-05-20 12:31:23 +02:00
Benjamin Bouvier
905d9b9aba refactor(timeline): don't reload a pinned event timeline that hasn't changed since the previous time 2025-05-20 10:49:08 +02:00
Benjamin Bouvier
810056cd4d refactor(timeline): add logging for the pinned events task 2025-05-20 10:49:08 +02:00
Richard van der Hoff
4d2c261ff8 crypto: rewrite check_sender_trust_requirement to use VerificationState (#5044)
There are two reasons for this.

Firstly. we've already done a bunch of work to map `SenderData` into a
`VerificationState`, and the decision tree from `VerificationState` to
allow/reject is simpler than going from `SenderData`, even if we have to
fudge it a bit to get the "legacy" flag. (Note that it allows us to get
rid of an `unreachable!` panic.)

Secondly, `VerficationState` represents the state of an *event*, whereas
`SenderData` is about the session as a whole. A session can be fine,
whilst events (claiming to be) encrypted with it can be suspect. What we
want here is to check a specific message. Currently, this doesn't make
any functional difference, but conceptually it's cleaner to check the
`VerificationState`.

Note that there are a bunch of tests for this method in
`matrix-sdk-crypto/src/machine/tests/decryption_verification_state.rs`,
called `test_decryption_trust_requirement`.
2025-05-19 18:35:21 +01:00
Ivan Enderlin
d4626835bb chore(base): Fix formatting. 2025-05-19 16:09:32 +02:00
Ivan Enderlin
f684883902 chore(base): Move RoomInfo inside another module.
This patch moves the `RoomInfo` type and its implementations inside the
`room_info` module.
2025-05-19 16:09:32 +02:00
Ivan Enderlin
cf6316e290 chore(base): Move BaseRoomInfo into its own module.
This patch extracts the `BaseRoomInfo` type and its implementations
inside its own module.
2025-05-19 16:09:32 +02:00
Ivan Enderlin
12caf12d8a doc(base): Fix a typo. 2025-05-19 16:09:32 +02:00
Ivan Enderlin
9809e1b53c doc(sdk): Fix a typo in an inline comment. 2025-05-19 15:58:58 +02:00
Ivan Enderlin
80b7eed14b task(sdk): Fix warnings error without e2e-encryption. 2025-05-19 15:58:58 +02:00
Ivan Enderlin
6980dc5628 doc(sdk): Add #5047. 2025-05-19 15:58:58 +02:00
Ivan Enderlin
9366bc85e9 refactor(sdk): Remove FrozenSlidingSync.
This patch removes `FrozenSlidingSync`. Its unique field is supposed to
be stored in the crypto store.
2025-05-19 15:58:58 +02:00
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