add_member provably always returns true.

master
Denis Kasak 2020-07-01 16:08:25 +02:00
parent 7abdeed449
commit 7943baee49
1 changed files with 7 additions and 7 deletions

View File

@ -358,9 +358,7 @@ impl Room {
} }
/// Process the member event of an entering user. /// Process the member event of an entering user.
/// fn add_member(&mut self, event: &MemberEvent) {
/// Returns true if this made a change to the room's state, false otherwise.
fn add_member(&mut self, event: &MemberEvent) -> bool {
let new_member = RoomMember::new(event); let new_member = RoomMember::new(event);
match event.membership_change() { match event.membership_change() {
@ -385,15 +383,15 @@ impl Room {
}; };
// Perform display name disambiguations, if necessary. // Perform display name disambiguations, if necessary.
let disambiguations = self.disambiguation_updates(&new_member, MemberDirection::Entering); let disambiguations =
self.disambiguation_updates(&new_member, MemberDirection::Entering);
for (id, name) in disambiguations.into_iter() { for (id, name) in disambiguations.into_iter() {
match name { match name {
None => self.disambiguated_display_names.remove(&id), None => self.disambiguated_display_names.remove(&id),
Some(name) => self.disambiguated_display_names.insert(id, name), Some(name) => self.disambiguated_display_names.insert(id, name),
}; };
} }
true
} }
/// Process the member event of a leaving user. /// Process the member event of a leaving user.
@ -584,7 +582,9 @@ impl Room {
match event.membership_change() { match event.membership_change() {
Invited | Joined => { Invited | Joined => {
self.add_member(event) self.add_member(event);
true
} }
Kicked | Banned | KickedAndBanned | InvitationRejected | Left => { Kicked | Banned | KickedAndBanned | InvitationRejected | Left => {
self.remove_member(event) self.remove_member(event)