matrix-sdk: Allow getting the user id from the client.

master
Damir Jelić 2020-07-05 16:47:38 +02:00
parent bd56c52b37
commit 669a3f22d2
1 changed files with 6 additions and 0 deletions

View File

@ -346,6 +346,12 @@ impl Client {
&self.homeserver
}
/// Get the user id of the current owner of the client.
pub async fn user_id(&self) -> Option<UserId> {
let session = self.base_client.session().read().await;
session.as_ref().cloned().map(|s| s.user_id)
}
/// Add `EventEmitter` to `Client`.
///
/// The methods of `EventEmitter` are called when the respective `RoomEvents` occur.