From 44974982e12bb9da79062db84e1e5f882fb9873f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sat, 23 Jan 2021 15:59:53 +0100 Subject: [PATCH] client: Add an accessor method for the device id --- matrix_sdk/src/client.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 5e1b5a0d..005d1486 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -425,6 +425,12 @@ impl Client { session.as_ref().cloned().map(|s| s.user_id) } + /// Get the device id that identifies the current session. + pub async fn device_id(&self) -> Option { + let session = self.base_client.session().read().await; + session.as_ref().map(|s| s.device_id.clone()) + } + /// Fetches the display name of the owner of the client. /// /// # Example