Ignore CTCP PINGs without timestamps
This commit is contained in:
parent
1f7d13399d
commit
f4f49c6dd3
1 changed files with 14 additions and 1 deletions
|
@ -469,7 +469,9 @@ impl IrcServer {
|
|||
try!(self.send_ctcp_internal(resp, "SOURCE https://github.com/aatxe/irc"));
|
||||
self.send_ctcp_internal(resp, "SOURCE")
|
||||
},
|
||||
"PING" => self.send_ctcp_internal(resp, &format!("PING {}", tokens[1])),
|
||||
"PING" if tokens.len() > 1 => {
|
||||
self.send_ctcp_internal(resp, &format!("PING {}", tokens[1]))
|
||||
},
|
||||
"TIME" => self.send_ctcp_internal(resp, &format!(
|
||||
"TIME :{}", now().rfc822z()
|
||||
)),
|
||||
|
@ -860,4 +862,15 @@ mod test {
|
|||
assert_eq!(&get_server_value(server)[..], "NOTICE test :\u{001}USERINFO :Testing.\u{001}\
|
||||
\r\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "ctcp")]
|
||||
fn ctcp_ping_no_timestamp() {
|
||||
let value = ":test!test@test PRIVMSG test :\u{001}PING\u{001}\r\n";
|
||||
let server = IrcServer::from_connection(test_config(), MockConnection::new(value));
|
||||
for message in server.iter() {
|
||||
println!("{:?}", message);
|
||||
}
|
||||
assert_eq!(&get_server_value(server)[..], "");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue