Updated code for line-wrapping.

This commit is contained in:
Aaron Weiss 2015-01-13 04:07:04 -05:00
parent 87fde7b212
commit da29644eb1

View file

@ -165,21 +165,20 @@ impl<T: IrcReader, U: IrcWriter> IrcServer<T, U> {
} }
if &msg.command[] == "PING" { if &msg.command[] == "PING" {
self.send(PONG(&msg.suffix.as_ref().unwrap()[], None)).unwrap(); self.send(PONG(&msg.suffix.as_ref().unwrap()[], None)).unwrap();
} else if &msg.command[] == "JOIN" || &msg.command[] == "PART" { } else if cfg!(not(feature = "nochanlists")) &&
(&msg.command[] == "JOIN" || &msg.command[] == "PART") {
let chan = match msg.suffix { let chan = match msg.suffix {
Some(ref suffix) => &suffix[], Some(ref suffix) => &suffix[],
None => &msg.args[0][], None => &msg.args[0][],
}; };
if cfg!(not(feature = "nochanlists")) { if let Some(vec) = self.chanlists.lock().unwrap().get_mut(&String::from_str(chan)) {
if let Some(vec) = self.chanlists.lock().unwrap().get_mut(&String::from_str(chan)) { if let Some(ref src) = msg.prefix {
if let Some(ref src) = msg.prefix { if let Some(i) = src.find('!') {
if let Some(i) = src.find('!') { if &msg.command[] == "JOIN" {
if &msg.command[] == "JOIN" { vec.push(User::new(&src[..i]));
vec.push(User::new(&src[..i])); } else {
} else { if let Some(n) = vec.as_slice().position_elem(&User::new(&src[..i])) {
if let Some(n) = vec.as_slice().position_elem(&User::new(&src[..i])) { vec.swap_remove(n);
vec.swap_remove(n);
}
} }
} }
} }