From 35dc12880737ecfff26789f0085de93780e3fa71 Mon Sep 17 00:00:00 2001 From: lancebord Date: Sat, 7 Mar 2026 11:56:03 -0500 Subject: a bunch of client cleanup --- src/client/state.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/client/state.rs') diff --git a/src/client/state.rs b/src/client/state.rs index b987509..6945d4e 100644 --- a/src/client/state.rs +++ b/src/client/state.rs @@ -1,10 +1,10 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; /// The full state of a connected IRC client. #[derive(Debug, Default)] pub struct ClientState { pub nick: String, - pub channels: HashMap, + pub channel: Channel, pub caps: HashSet, pub server_name: Option, pub reg: RegistrationState, @@ -17,20 +17,6 @@ impl ClientState { ..Default::default() } } - - pub fn channel(&self, name: &str) -> Option<&Channel> { - self.channels.get(&name.to_lowercase()) - } - - pub fn channel_mut(&mut self, name: &str) -> &mut Channel { - self.channels - .entry(name.to_lowercase()) - .or_insert_with(|| Channel::new(name)) - } - - pub fn remove_channel(&mut self, name: &str) { - self.channels.remove(&name.to_lowercase()); - } } /// State of the registration handshake. @@ -44,7 +30,7 @@ pub enum RegistrationState { } /// A joined channel and its current state. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Channel { pub name: String, pub members: HashSet, -- cgit v1.2.3-59-g8ed1b