Respond to PINGs in the identify loop
This commit is contained in:
parent
c399d2569b
commit
077dfe3cb0
|
@ -64,6 +64,10 @@ impl Client {
|
|||
|
||||
loop {
|
||||
if let Ok(ref command) = self.read() {
|
||||
if let Command::PING(code) = command {
|
||||
self.write_command(Command::PONG(code.to_string()))?;
|
||||
continue;
|
||||
}
|
||||
if let Command::OTHER(line) = command {
|
||||
if line.contains("001") {
|
||||
break;
|
||||
|
|
|
@ -17,14 +17,11 @@ fn main() -> Result<(), std::io::Error> {
|
|||
Box::new(["#main", "#main2"]),
|
||||
);
|
||||
let mut client =
|
||||
Client::new("192.168.178.100", 6667, config).expect("Unable to connect to IRC server");
|
||||
Client::new("192.168.1.28", 6667, config).expect("Unable to connect to IRC server");
|
||||
client.identify()?;
|
||||
|
||||
loop {
|
||||
if let Ok(ref command) = client.read() {
|
||||
if let Command::PING(code) = command {
|
||||
client.write_command(Command::PONG(code.to_string()))?;
|
||||
}
|
||||
if let Command::OTHER(line) = command {
|
||||
print!("{}", line);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue