Implement BaseClient::get_session to retrieve the login session.

Closes #100.
master
Denis Kasak 2020-10-12 15:11:43 +02:00
parent d039a39d84
commit 2afc0c7661
1 changed files with 10 additions and 0 deletions

View File

@ -1886,6 +1886,16 @@ impl BaseClient {
}
}
/// Get the user login session.
///
/// If the client is currently logged in, this will return a `matrix_sdk::Session` object which
/// can later be given to `restore_login`.
///
/// Returns a session object if the client is logged in. Otherwise returns `None`.
pub async fn get_session(&self) -> Option<Session> {
self.session.read().await.clone()
}
/// Get a map holding all the devices of an user.
///
/// This will always return an empty map if the client hasn't been logged