Uhm, stuff

This commit is contained in:
famfo 2022-01-14 14:17:33 +01:00
parent e416d161bb
commit 41fd72cb93
2 changed files with 10 additions and 7 deletions

View file

@ -216,6 +216,8 @@ pub enum Command {
TOPIC_BY(String, String), TOPIC_BY(String, String),
#[doc(hidden)] #[doc(hidden)]
USER(String, String, String, String), USER(String, String, String, String),
#[doc(hidden)]
WELCOME(),
} }
impl Command { impl Command {
@ -268,6 +270,9 @@ impl Command {
let server = parts[3]; let server = parts[3];
Self::PONG(parts[2].to_string(), (server[1..]).to_string()) Self::PONG(parts[2].to_string(), (server[1..]).to_string())
} }
Some(&"001") => {
Self::WELCOME()
}
_ => Self::OTHER(new.to_string()), _ => Self::OTHER(new.to_string()),
} }
} }

View file

@ -145,12 +145,9 @@ impl Client {
commands::Command::PING(code) => { commands::Command::PING(code) => {
self.pong(&code).await?; self.pong(&code).await?;
} }
commands::Command::OTHER(line) => { commands::Command::WELCOME() => {
tracing::trace!("{}", line);
if line.contains("001") {
break; break;
} }
}
_ => {} _ => {}
} }
} }
@ -219,8 +216,9 @@ impl Client {
let command = commands::Command::command_from_str(string).await; let command = commands::Command::command_from_str(string).await;
if let commands::Command::PING(command) = command { if let commands::Command::PING(command) = command {
if let Err(_e) = self.pong(&command).await { if let Err(e) = self.pong(&command).await {
return Ok(None); tracing::error!("{}", e);
return Err(e);
} }
return Ok(Some(commands::Command::PING("".to_string()))); return Ok(Some(commands::Command::PING("".to_string())));
} }