diff --git a/rust-sdk/src/machine.rs b/rust-sdk/src/machine.rs index 7581c2b4e7..c250d0d8e5 100644 --- a/rust-sdk/src/machine.rs +++ b/rust-sdk/src/machine.rs @@ -387,6 +387,15 @@ impl OlmMachine { .block_on(self.inner.update_tracked_users(users.iter())); } + /// Check if the given user is considered to be tracked. + /// + /// A user can be marked for tracking using the + /// [`OlmMachine::update_tracked_users()`] method. + pub fn is_user_tracked(&self, user_id: &str) -> Result { + let user_id = UserId::try_from(user_id)?; + Ok(self.inner.tracked_users().contains(&user_id)) + } + /// Generate one-time key claiming requests for all the users we are missing /// sessions for. /// diff --git a/rust-sdk/src/olm.udl b/rust-sdk/src/olm.udl index 2590afbed7..894d9afe3c 100644 --- a/rust-sdk/src/olm.udl +++ b/rust-sdk/src/olm.udl @@ -271,6 +271,8 @@ interface OlmMachine { [Throws=CryptoStoreError] sequence get_user_devices([ByRef] string user_id); + [Throws=CryptoStoreError] + boolean is_user_tracked([ByRef] string user_id); void update_tracked_users(sequence users); [Throws=CryptoStoreError] Request? get_missing_sessions(sequence users);