rust: Expose a method to check if a user is tracked

This commit is contained in:
Damir Jelić 2021-11-24 14:11:56 +01:00
parent 87339fb0ee
commit ac153c80d5
2 changed files with 11 additions and 0 deletions

View file

@ -387,6 +387,15 @@ impl OlmMachine {
.block_on(self.inner.update_tracked_users(users.iter())); .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<bool, CryptoStoreError> {
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 /// Generate one-time key claiming requests for all the users we are missing
/// sessions for. /// sessions for.
/// ///

View file

@ -271,6 +271,8 @@ interface OlmMachine {
[Throws=CryptoStoreError] [Throws=CryptoStoreError]
sequence<Device> get_user_devices([ByRef] string user_id); sequence<Device> get_user_devices([ByRef] string user_id);
[Throws=CryptoStoreError]
boolean is_user_tracked([ByRef] string user_id);
void update_tracked_users(sequence<string> users); void update_tracked_users(sequence<string> users);
[Throws=CryptoStoreError] [Throws=CryptoStoreError]
Request? get_missing_sessions(sequence<string> users); Request? get_missing_sessions(sequence<string> users);