Implement Room::member_is_tracked.

master
Denis Kasak 2020-07-09 10:09:57 +02:00
parent 949305da72
commit ec81a5e539
1 changed files with 7 additions and 0 deletions

View File

@ -426,6 +426,13 @@ impl Room {
(true, disambiguations) (true, disambiguations)
} }
/// Check whether the user with the MXID `user_id` is joined or invited to the room.
///
/// Returns true if so, false otherwise.
pub fn member_is_tracked(&self, user_id: &UserId) -> bool {
self.invited_members.contains_key(&user_id) || self.joined_members.contains_key(&user_id)
}
/// Get a room member by user ID. /// Get a room member by user ID.
/// ///
/// If there is no such member, returns `None`. /// If there is no such member, returns `None`.