Add accessor for room member avatar urls

This commit is contained in:
Amanda Graven 2021-01-15 18:44:32 +01:00 committed by Damir Jelić
parent bab8fde0ac
commit aadbc14dc6

View file

@ -56,6 +56,13 @@ impl RoomMember {
}
}
pub fn avatar_url(&self) -> Option<&str> {
match self.profile.as_ref() {
Some(p) => p.avatar_url.as_deref(),
None => self.event.content.avatar_url.as_deref(),
}
}
pub fn normalized_power_level(&self) -> i64 {
if self.max_power_level > 0 {
(self.power_level() * 100) / self.max_power_level