mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Avoid adding a user to a chat channel more than once
This commit is contained in:
@@ -79,7 +79,11 @@ impl ChatRoom {
|
||||
channel: crate::events::room_join::RoomJoined::CHANNEL,
|
||||
reliable: true,
|
||||
});
|
||||
self.online_users.push(handle);
|
||||
if !self.online_users.iter().any(|other| other.name() == handle.name()) {
|
||||
self.online_users.push(handle);
|
||||
} else {
|
||||
log::warn!("User {} tried to join channel {} again", handle.name(), self.name);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_user(&mut self, name: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user