async_client: Allow setting the initial device display name.
parent
ddaf630063
commit
7595cab178
|
@ -47,7 +47,9 @@ async fn login(
|
|||
|
||||
client.add_event_callback(async_cb);
|
||||
|
||||
client.login(username, password, None).await?;
|
||||
client
|
||||
.login(username, password, None, Some("rust-sdk".to_string()))
|
||||
.await?;
|
||||
client.sync_forever(SyncSettings::new(), |_| async {}).await;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -341,6 +341,7 @@ impl AsyncClient {
|
|||
user: S,
|
||||
password: S,
|
||||
device_id: Option<S>,
|
||||
initial_device_display_name: Option<S>,
|
||||
) -> Result<login::Response> {
|
||||
info!("Logging in to {} as {:?}", self.homeserver, user);
|
||||
|
||||
|
@ -350,7 +351,7 @@ impl AsyncClient {
|
|||
password: password.into(),
|
||||
},
|
||||
device_id: device_id.map(|d| d.into()),
|
||||
initial_device_display_name: None,
|
||||
initial_device_display_name: initial_device_display_name.map(|d| d.into()),
|
||||
};
|
||||
|
||||
let response = self.send(request).await?;
|
||||
|
|
|
@ -22,7 +22,7 @@ fn login() {
|
|||
|
||||
let mut client = AsyncClient::new(homeserver, None).unwrap();
|
||||
|
||||
rt.block_on(client.login("example", "wordpass", None))
|
||||
rt.block_on(client.login("example", "wordpass", None, None))
|
||||
.unwrap();
|
||||
|
||||
let logged_in = rt.block_on(client.logged_in());
|
||||
|
|
Loading…
Reference in New Issue