Commit Graph

1931 Commits

Author SHA1 Message Date
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
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
Stefan Ceriu
cb92971657 chore(ui): move TimelineItemContent::UnableToDecrypt to MsgLikeKind::UnableToDecrypt 2025-03-28 15:30:47 +02:00
Stefan Ceriu
5a35fec894 chore(ui): rename RedactedMessage to just Redacted 2025-03-28 15:30:47 +02:00
Stefan Ceriu
43b8f83e4b chore(ui): move TimelineItemContent::RedactedMessage to MsgLikeKind::RedactedMessage 2025-03-28 15:30:47 +02:00
Stefan Ceriu
76f92ba9af chore(ui): rename AggregatedTimelineItemContent to MsgLikeContent and AggregatedTimelineItemContentKind to MsgLikeKind.
- we decided on this naming convention to keep consistent with Ruma which uses `MsgLike` as well
2025-03-27 15:53:31 +02:00
Johannes Marbach
f3baf7efd2 refactor(timeline): push the reply logic down into matrix_sdk (#4842)
This achieves step 2 of #4835.

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-03-27 13:47:51 +01:00
Stefan Ceriu
4f3b40d6fb feat!(timeline): Introduce an extra TimelineItemContent layer that holds aggregations (#4839)
In preparation for threads we have realised that the `reactions`,
`thread_root` and `in_reply_to` were only available on `Message` types,
which doesn't play well with Stickers and Polls.

This PR introduces a new `Aggregated` `TimelineItemContent` variant
which holds the message `kind` (Message, Sticker, Poll) as well as well
as any related aggregated data. it will help treat them all in a similar
fashion as well as account for future changes.

There are no functional changes, it's mostly about moving code around
and the FFI interfaces haven't changed.

Part of #4833.
2025-03-26 16:27:03 +00:00
Kévin Commaille
e0e9c06ca4 Don't use serde to avoid returning an error
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-26 15:26:55 +01:00
Kévin Commaille
eb313efdeb Don't qualify error! macro
It's already imported.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-26 15:26:55 +01:00
Kévin Commaille
bc22ff1221 refactor(oauth): Introduce AccountManagementUrlBuilder
It allows to reuse the URL for different actions more easily than having
to call `OAuth::account_management_url` every time for a different
action.

It also adds a method with fallback if we want to ignore action
serialization errors, to always present a URL.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-26 15:26:55 +01:00
Benjamin Bouvier
f5b6767253 feat(timeline): add a timeline start virtual item 2025-03-26 11:33:20 +01:00
Benjamin Bouvier
b83889dcba fix(ffi): propagate initial values before the future is picked by a runtime 2025-03-26 11:18:23 +01:00
Benjamin Bouvier
fc8a6dc9b1 refactor(ffi): always try to load InReplyToDetails from the event cache or network 2025-03-25 11:06:31 +01:00
Johannes Marbach
f8236a8b96 feat(timeline): add functions for sending messages in threads
`send_reply` is geared towards clients that don't render threads themselves. It sends a reply and optionally forwards it onto any existing thread.

This PR adds `send_thread_reply` for clients that do render threads themselves. This sends a message onto a thread, regardless of whether a thread existed before, and includes the fallback for non-threaded clients only if the message is not itself a reply on the thread.

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-03-24 14:31:20 +01:00
Kévin Commaille
f6c5addf55 refactor(sdk): Remove experimental-oidc feature
Now that is compiles under WASM and that the API was cleaned up, it
should be okay.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
b3e82a05db refactor(oauth): Merge OAuth::login_with_oidc_callback() and OAuth::finish_login()
Accept a URL or a query string for simplicity.

That way we don't need to expose AuthorizationResponse.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
a8aa364757 refactor(oauth): Allow to use any registration method with OAuth::login
Gets rid of OAuth::url_for_oidc since it can be replaced by a call to
OAuth::login now.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
7457ecb1a8 feat(oauth): Allow to use any registration method with login_with_qr_code
Introduces the ClientRegistrationMethod type

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
095425f664 refactor(oauth): Do not take static registrations in default OAuthRegistrationStore constructor
It complicates the constructor and most clients will probably not need to use it.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
ca4e212e98 refactor(oauth): Make OAuthRegistrationStore methods async
Since they perform blocking I/O we probably don't want to block a thread on that.

We use spawn_blocking, the alternative would be to use tokio::fs functions, which do the same thing and would require to load the whole file content in memory before (de)serialization.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
1a79ea94ed refactor(oauth): Improve OAuthRegistrationError variants
Make them more precise instead of wrapping several error types into a single variant.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
6803538c2e refactor(oauth): Rename OidcRegistrations to OAuthRegistrationStore
Use the same prefix as the other types in the OAuth 2.0 API, and use the
same suffix as other data-persisting APIs for consistency.

It also avoids to have two modules with very similar names, the only
difference being a trailing `s`.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
9d27e9b379 refactor(oauth): Make registrations module private
Since it only contains 2 types, it doesn't seem worth it to expose it,
we can just expose the types elsewhere.
2025-03-21 10:49:46 +01:00
Kévin Commaille
8683ca4d13 refactor(oauth): Re-export ClientID from the oauth module
Since it is now used everywhere, there is no reason to reexport it from
the registrations module.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Benjamin Bouvier
d4f5ac152a feat(ffi): log the log targets and levels 2025-03-21 09:37:25 +01:00
Benjamin Bouvier
31a1724390 feat(ffi): add support for log bundles 2025-03-21 09:37:25 +01:00
Kévin Commaille
45dd96e30a refactor(oauth): Merge finish_authorization and finish_login
That way users only need to call finish_login, since there is no other
reason to call finish_authorization currently.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-20 16:02:18 +00:00
Hugh Nimmo-Smith
3f4c1fd1bb feat(widgets, element-call): Update the widget url generation
Fixes: #4793

There was a previous PR https://github.com/matrix-org/matrix-rust-sdk/pull/4802 which attempted to implement this, but missed some backwards compatibility needs.

This updated PR has the original commit and then additional commits to add the compatibility (along with tests for the new intent param generally).
2025-03-20 14:28:45 +00:00
Benjamin Bouvier
5acaaf5865 fix(ffi): call the back-pagination status callback immediately 2025-03-20 10:26:54 +01:00
Hugh Nimmo-Smith
a0eb9340d5 Revert "feat(widgets, element-call) Update the widget url generation (#4802)"
This reverts commit 3b9ae3e65e.
2025-03-19 17:49:21 +01:00
Jonas Richard Richter
dbdbfd0b38 feat(notification): Add support for custom conditional push rules (#4587)
---
Signed-off-by: Jonas Richard Richter <jonas-richard.richter@telekom.de>
2025-03-19 12:50:02 +01:00
Timo
3b9ae3e65e feat(widgets, element-call) Update the widget url generation (#4802)
Fixes: https://github.com/matrix-org/matrix-rust-sdk/issues/4793

Co-authored-by: Valere <bill.carson@valrsoft.com>
2025-03-19 11:29:07 +02:00
Kévin Commaille
b9c970dc43 refactor(oauth): Rename OauthGrantType to OAuthGrantType
For consistency.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
ba5e395a59 refactor(oauth): Change Oauth prefix for error types to OAuth
For consistency.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
c0d3ed1a90 refactor(oauth): Rename provider_metadata to server_metadata
"Provider" is an OpenID Connect term. OAuth 2.0 uses the "authorization
server" term.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
00d7a77ebe refactor(encryption): Rename OidcCrossSigningResetInfo to OAuthCrossSigningResetInfo
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
f29d3fd666 refactor(oauth): Rename OidcAuthCodeUrlBuilder to OAuthAuthCodeUrlBuilder
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
47204830a9 refactor(oauth): Rename OidcError to OAuthError
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
f4bb14a30e refactor(oauth): Rename OidcSession to OAuthSession
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
6f3694cfa9 refactor(oauth): Rename Oidc API to OAuth
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
1658610f93 refactor(sdk): Rename oidc module to oauth
Since we mostly use OAuth 2.0 now.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-18 17:18:34 +01:00
Kévin Commaille
7713ce768a refactor(oidc): Create ClientMetadata type
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-14 18:03:34 +01:00
Kévin Commaille
6f44853bf7 refactor(oidc): Use Url for the issuer
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-14 18:03:34 +01:00
Kévin Commaille
2c6c818005 refactor(oidc): Use ruma's server metadata type
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-14 18:03:34 +01:00
Kévin Commaille
9adff21f78 refactor(oidc): Import code for building the account management URL
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-14 18:03:34 +01:00
Jorge Martín
a941cc824d fix(ffi): Restore some needed OIDC prompts in the FFI layer
These prompts were used in the Element X app, probably in some other clients too.

Since Ruma removed these cases, we're just passing them as `_Custom(value)` ones, which do work.
2025-03-12 13:12:09 +01:00
Benjamin Bouvier
d3daa18bf8 feat!(ffi): rename setup_tracing into init_platform (#4790)
And make it take a boolean indicating whether we want to set up a
lightweight tokio runtime or not, instead of having
`setup_lightweight_tokio_runtime` as a public function + another
function, both of which would have to be called anyways.

cc @stefanceriu @jmartinesp
2025-03-12 09:41:01 +00:00
Ivan Enderlin
2ac3b6e9a2 chore(ffi): Remove useless block_on.
This patch removes the last `block_on` calls in `matrix-sdk-ffi`. Those
are artifacts of the past.
2025-03-11 16:37:44 +01:00