Add accessor for room member avatar urls

master
Amanda Graven 2021-01-15 18:44:32 +01:00 committed by Damir Jelić
parent bab8fde0ac
commit aadbc14dc6
1 changed files with 7 additions and 0 deletions

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 { pub fn normalized_power_level(&self) -> i64 {
if self.max_power_level > 0 { if self.max_power_level > 0 {
(self.power_level() * 100) / self.max_power_level (self.power_level() * 100) / self.max_power_level