nio: Add scaffolding for member removals in the base client.

This commit is contained in:
Damir Jelić 2019-11-14 20:18:31 +01:00
parent 0760706e58
commit 10b8d1a682

View file

@ -74,6 +74,14 @@ impl Room {
true
}
fn remove_member(&mut self, event: &MemberEvent) -> bool {
if !self.members.contains_key(&event.state_key) {
return false;
}
true
}
fn update_joined_member(&mut self, event: &MemberEvent) -> bool {
if let Some(member) = self.members.get_mut(&event.state_key) {
member.display_name = event.content.displayname.clone();
@ -88,7 +96,7 @@ impl Room {
Some(c) => match c.membership {
MembershipState::Join => self.update_joined_member(event),
MembershipState::Invite => self.add_member(event),
MembershipState::Leave => self.add_member(event),
MembershipState::Leave => self.remove_member(event),
_ => false,
},
None => self.add_member(event),