async_client: Allow setting the initial device display name.

This commit is contained in:
Damir Jelić 2020-03-27 09:22:29 +01:00
parent ddaf630063
commit 7595cab178
3 changed files with 6 additions and 3 deletions

View file

@ -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(())

View file

@ -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?;

View file

@ -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());