async_client: Allow setting the initial device display name.

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