File tree Expand file tree Collapse file tree 5 files changed +18
-17
lines changed
bindings/matrix-sdk-ffi/src Expand file tree Collapse file tree 5 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -662,7 +662,7 @@ impl Client {
662662 pub fn get_profile ( & self , user_id : String ) -> Result < UserProfile , ClientError > {
663663 RUNTIME . block_on ( async move {
664664 let owned_user_id = UserId :: parse ( user_id. clone ( ) ) ?;
665- let response = self . inner . get_profile ( & owned_user_id) . await ?;
665+ let response = self . inner . account ( ) . fetch_user_profile_of ( & owned_user_id) . await ?;
666666
667667 let user_profile = UserProfile {
668668 user_id,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Breaking changes:
1010- Replace ` impl MediaEventContent ` with ` &impl MediaEventContent ` in
1111 ` Media::get_file ` /` Media::remove_file ` /` Media::get_thumbnail ` /` Media::remove_thumbnail `
1212- A custom sliding sync proxy set with ` ClientBuilder::sliding_sync_proxy ` now takes precedence over a discovered proxy.
13+ - ` Client::get_profile ` was moved to ` Account ` and renamed to ` Account::fetch_user_profile_of ` . ` Account::get_profile ` was renamed to ` Account::fetch_user_profile ` .
1314
1415Additions:
1516
Original file line number Diff line number Diff line change @@ -261,18 +261,29 @@ impl Account {
261261 /// # async {
262262 /// # let homeserver = Url::parse("http://localhost:8080")?;
263263 /// # let client = Client::new(homeserver).await?;
264- /// let profile = client.account().get_profile ().await?;
264+ /// let profile = client.account().fetch_user_profile ().await?;
265265 /// println!(
266266 /// "You are '{:?}' with avatar '{:?}'",
267267 /// profile.displayname, profile.avatar_url
268268 /// );
269269 /// # anyhow::Ok(()) };
270270 /// ```
271- pub async fn get_profile ( & self ) -> Result < get_profile:: v3:: Response > {
271+ pub async fn fetch_user_profile ( & self ) -> Result < get_profile:: v3:: Response > {
272272 let user_id = self . client . user_id ( ) . ok_or ( Error :: AuthenticationRequired ) ?;
273+ self . fetch_user_profile_of ( user_id) . await
274+ }
275+
276+ /// Get the profile for a given user id
277+ ///
278+ /// # Arguments
279+ ///
280+ /// * `user_id` the matrix id this function downloads the profile for
281+ pub async fn fetch_user_profile_of (
282+ & self ,
283+ user_id : & UserId ,
284+ ) -> Result < get_profile:: v3:: Response > {
273285 let request = get_profile:: v3:: Request :: new ( user_id. to_owned ( ) ) ;
274- let request_config = self . client . request_config ( ) . force_auth ( ) ;
275- Ok ( self . client . send ( request, Some ( request_config) ) . await ?)
286+ Ok ( self . client . send ( request, Some ( RequestConfig :: short_retry ( ) . force_auth ( ) ) ) . await ?)
276287 }
277288
278289 /// Change the password of the account.
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ use ruma::{
4848 } ,
4949 filter:: { create_filter:: v3:: Request as FilterUploadRequest , FilterDefinition } ,
5050 membership:: { join_room_by_id, join_room_by_id_or_alias} ,
51- profile:: get_profile,
5251 push:: { set_pusher, Pusher } ,
5352 room:: create_room,
5453 session:: login:: v3:: DiscoveryInfo ,
@@ -2048,16 +2047,6 @@ impl Client {
20482047 self . send ( request, None ) . await
20492048 }
20502049
2051- /// Get the profile for a given user id
2052- ///
2053- /// # Arguments
2054- ///
2055- /// * `user_id` the matrix id this function downloads the profile for
2056- pub async fn get_profile ( & self , user_id : & UserId ) -> Result < get_profile:: v3:: Response > {
2057- let request = get_profile:: v3:: Request :: new ( user_id. to_owned ( ) ) ;
2058- Ok ( self . send ( request, Some ( RequestConfig :: short_retry ( ) ) ) . await ?)
2059- }
2060-
20612050 /// Get the notification settings of the current owner of the client.
20622051 pub async fn notification_settings ( & self ) -> NotificationSettings {
20632052 let ruleset = self . account ( ) . push_rules ( ) . await . unwrap_or_else ( |_| Ruleset :: new ( ) ) ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl WidgetSettings {
9191 props : ClientProperties ,
9292 ) -> Result < Url , url:: ParseError > {
9393 self . _generate_webview_url (
94- room. client ( ) . account ( ) . get_profile ( ) . await . unwrap_or_default ( ) ,
94+ room. client ( ) . account ( ) . fetch_user_profile ( ) . await . unwrap_or_default ( ) ,
9595 room. own_user_id ( ) ,
9696 room. room_id ( ) ,
9797 room. client ( ) . device_id ( ) . unwrap_or ( "UNKNOWN" . into ( ) ) ,
You can’t perform that action at this time.
0 commit comments