Commit Graph

8364 Commits

Author SHA1 Message Date
Mauro
3f627f4125 Merge branch 'main' into mauroromito/directory_search 2024-03-05 11:44:15 +01:00
dependabot[bot]
98a68632df chore(deps): bump mio from 0.8.10 to 0.8.11
Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.10 to 0.8.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.8.10...v0.8.11)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 10:42:26 +01:00
Jorge Martin Espinosa
0c98e26a05 sdk: create new users_with_power_levels fn (#3182)
It maps user ids to users' power levels.

Also, make sure it just returns an empty map if this info is not available, instead of crashing. 

Then use it in the FFI side to output updated data for the `RoomInfo`.

---

* sdk: create new `users_with_power_levels` fn which maps user ids to users' power levels

Also, make sure it just returns an empty map if this info is not available, instead of crashing.

* Update crates/matrix-sdk/src/room/mod.rs

Co-authored-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Jorge Martin Espinosa <angel.arasthel@gmail.com>

* Improve tests

---------

Signed-off-by: Jorge Martin Espinosa <angel.arasthel@gmail.com>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-03-04 16:37:16 +01:00
Benjamin Bouvier
4b56ca1841 event cache: remove the RoomNotFound error
Having `EventCache::for_room` return an `Option` avoids the need for the error. One caller can
safely unwrap it, and others can log and ignore rooms that have disappeared (like we do in `call_sync_response_handlers`).
2024-03-04 15:11:14 +01:00
Benjamin Bouvier
8d2e790bca event cache: add a Room::event_cache() method
This keeps the `RoomNotFound` error, which could still happen in theory if the `EventCache` is
being misused internally.
2024-03-04 15:11:14 +01:00
Stefan Ceriu
e4be216731 feat: add support for m.call.invite events in the timeline and as a last room message 2024-03-04 14:57:01 +01:00
Benjamin Bouvier
74727e5f84 ci: update codecov action to v4 2024-03-04 12:25:19 +01:00
Andy Balaam
4b711e4b37 Merge pull request #3177 from matrix-org/doug/multi-user-power-levels
FFI: Update the power levels of multiple users at once.
2024-03-04 10:10:28 +00:00
Mauro Romito
4db69647ce Merge branch 'mauroromito/directory_search' of github.com:matrix-org/matrix-rust-sdk into mauroromito/directory_search 2024-03-01 17:25:16 +01:00
Mauro Romito
e922a58cc3 tests: fix fmt 2024-03-01 17:25:11 +01:00
Mauro
eb0ddbc063 Merge branch 'main' into mauroromito/directory_search 2024-03-01 17:18:08 +01:00
Mauro Romito
9fbc2ab07c mocking library not supported on wasm 2024-03-01 17:17:24 +01:00
Mauro Romito
2f7b2f0451 fix: fmt 2024-03-01 17:07:52 +01:00
Mauro Romito
ad1623da58 docs: fixed docs 2024-03-01 15:44:24 +01:00
Mauro Romito
2abe3aba4a improved docs 2024-03-01 15:21:57 +01:00
Andy Balaam
82684d64d4 Merge pull request #3180 from matrix-org/jme/bump-uniffi-referenced-commit-so-android-works-again
ffi: bump the UniFFi referenced commit again
2024-03-01 13:27:53 +00:00
Jorge Martín
7b40daa3cf ffi: bump the UniFFi referenced commit again
At the moment, the SDK can't be built for Android because of these 2 issues:

- https://github.com/mozilla/uniffi-rs/issues/1996
- https://github.com/mozilla/uniffi-rs/issues/1995

Those have been fixed in the new commit.
2024-03-01 13:59:12 +01:00
Timo Kösters
5ee3897f7e ffi: aggregate RoomMember fields early instead of requiring to call getters (#3172)
This does two things:

- raise the timeout value for the `/members` queries, because they can super slow in Synapse because of nasal demons,
- and aggregate all the fields of `RoomMember` early, so users don't have to call getters to read each field.

---

* room_members: Export plain old data for room members to avoid FFI calls

Signed-off-by: Timo Kösters <timo@koesters.xyz>

* room_member: Respond to review feedback

* room_member: Remove previous RoomMember struct

* ffi: rename ExportedRoomMember to RoomMember

---------

Signed-off-by: Timo Kösters <timo@koesters.xyz>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-02-29 17:27:21 +01:00
Benjamin Bouvier
370f4735f7 ffi: simplify the declaration type 2024-02-29 15:03:45 +01:00
Mauro
77ba3010cc Merge branch 'main' into mauroromito/directory_search 2024-02-29 14:29:31 +01:00
Mauro Romito
b2b9b5fa12 feat(bindings): reverted some code from ffi 2024-02-29 14:29:03 +01:00
Doug
c251f16292 ffi: Update the power levels of multiple users as once. 2024-02-29 13:12:30 +00:00
Mauro Romito
8890bf3cee feat(bindings): improved and fixed ffi code 2024-02-29 14:10:45 +01:00
Mauro Romito
2e3ced1fb2 docs: more documentation 2024-02-29 12:58:34 +01:00
Mauro Romito
2163ab03ec tests: test improvements and added a new test 2024-02-29 12:48:49 +01:00
Mauro
4b1eefca80 Apply suggestions from code review
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Signed-off-by: Mauro <34335419+Velin92@users.noreply.github.com>
2024-02-29 11:52:31 +01:00
Mauro Romito
4dd7c3093c tests: improved the tests by adding the limit
into the check for the request
2024-02-28 19:41:31 +01:00
Mauro Romito
70466aafb4 docs: more documentation for types and the mod 2024-02-28 19:25:52 +01:00
Mauro Romito
3e35f163b7 docs: updated documentation
and removed code from ffi that will be changed soon
2024-02-28 19:17:58 +01:00
Mauro Romito
690ed4611d tests: unit tests have been completed 2024-02-28 19:01:42 +01:00
Stefan Ceriu
8392ef07cd ffi: bump uniffi to latest git rev to generate open swift classes 2024-02-28 18:46:26 +01:00
Mauro Romito
9c33540af8 tests: improved tests and added a unit test 2024-02-28 16:18:35 +01:00
Doug
0401b995b7 ffi: Expose getting a power level from a role. 2024-02-28 13:27:10 +01:00
Andy Balaam
0521d23e94 Merge pull request #3167 from matrix-org/andybalaam/doc-fixes-e2ee
docs: Punctuation and wording fixes in encryption docs
2024-02-28 09:56:19 +00:00
Mauro Romito
37d95571e9 test: fixed a test by a adding a small delay 2024-02-27 17:40:03 +01:00
Mauro Romito
caa9a7d8be tests: code improvement for the filter integration test 2024-02-27 17:31:26 +01:00
Mauro Romito
d9231be1ba feat(bindings): listener code 2024-02-27 17:08:55 +01:00
Jorge Martin Espinosa
2068e7f266 sdk & ffi: add user power levels and role getter to RoomInfo (#3170)
Changes:
- sdk: Add `get_user_power_level` and `get_suggested_user_role` functions so we don't need to load the whole room member list to know if a user has some power level/role.
- ffi: add an FFI fn for `get_suggested_user_role`.
- ffi: add `user_power_levels` to `RoomInfo`.

The goal of this PR is being able to fetch a user's power level or role almost immediately and avoid having to load and find the user in the room member list, which can be very slow to load (especially in EX Android).

---

* sdk: Add `get_user_power_level` and `get_suggested_user_role` functions to get the power level for a user without loading the room member list.

* ffi: add `suggested_role_for_user` fn, which calls the new `get_suggested_user_role` fn in Room

* sdk: add test

* ffi: add user power level info to `RoomInfo`

* Add changes to changelog

* sdk: Fix docs formatting

* sdk & ffi: use `&UserId` instead of `OwnedUserId`

Also, simplify error mapping.

* sdk: add extra test

* ffi: fix `OwnedUserId` -> `&UserId` conversion

* sdk: Replace `UserId::parse` with `user_id!` macro for literals in tests

* Update crates/matrix-sdk/tests/integration/room/joined.rs

Signed-off-by: Benjamin Bouvier <public@benj.me>

---------

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-02-27 16:04:08 +01:00
Mauro Romito
26b0b32e55 feat(bindings): ffi layer started implementation
also improved the integration test for the filtered case
2024-02-27 14:37:22 +01:00
Andy Balaam
c7f3e2ad1d docs: Punctuation and wording fixes in encryption docs
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2024-02-27 10:16:03 +00:00
Mauro Romito
a79c5286d7 improved the tests 2024-02-27 10:58:13 +01:00
Mauro Romito
8ac6845607 feat: paginated public room search 2024-02-26 17:32:52 +01:00
Benjamin Bouvier
9f75552c9b event cache: only emit an event update when there are, well, events to propagate
Mostly an optimization that was also revealed by the previous version of the test failing, because it would receive an initial update with empty
events.
2024-02-26 16:05:23 +01:00
Benjamin Bouvier
3ef5214587 event cache: add a few smoke tests
This adds a few basic tests for the event cache, notably one for the `add_initial_events`, for something I identified while working on the code, but
that could've caused bad issues:

The `test_add_initial_events` checks that even if we received updates with meaningful events for a room, the room's events are cleared before we add initial events (since
we have no ways to know where to insert the events, in this case). In the future, we can keep this test as a "smoke test" for basic functionality of
the event cache.
2024-02-26 16:05:23 +01:00
Valere
30640ebb65 sdk: Log the successful room message sending and record the received event ID 2024-02-26 11:40:38 +01:00
Doug
4f3cdfacaa docs: Clarify PR title guidelines. 2024-02-26 10:31:28 +01:00
Johannes Marbach
b68bcf9cff fix(examples): Fix typos in getting started example
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2024-02-25 11:35:59 +01:00
Doug
8e64341176 ffi: Use a custom RollingFileAppender.
The built in hourly preset doesn't let us specify a max file count. Plus this way we can add a file extension too.
2024-02-23 11:49:47 +01:00
Benjamin Bouvier
40ba98b95e test: fix one potential race in test_room_notification_count
We're subscribing to settings updates *after* sending a request to change a setting. In an unlucky scenario, the following sequence of events could happen:

- sending request to change the settings
- response is received
- we set up the receiver to settings updates, but it's too late

The fix would then be to subscribe to the changes *before* we even send the request to update settings.
2024-02-22 18:01:53 +01:00
Benjamin Bouvier
3541d205e0 test: timeout faster in test_room_notification_count 2024-02-22 18:01:53 +01:00