1
0
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:
NG (Graham)
2026-01-04 17:22:11 -05:00
parent 09c1d2b344
commit 8a759c74c9

View File

@@ -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 {