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),
#[doc(hidden)]
USER(String, String, String, String),
#[doc(hidden)]
WELCOME(),
}
impl Command {
@ -268,6 +270,9 @@ impl Command {
let server = parts[3];
Self::PONG(parts[2].to_string(), (server[1..]).to_string())
}
Some(&"001") => {
Self::WELCOME()
}
_ => Self::OTHER(new.to_string()),
}
}

View file

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