Handle the case of a single SOH in PRIVMSG
This commit is contained in:
parent
e3decd470d
commit
199f591e78
1 changed files with 16 additions and 1 deletions
|
@ -336,7 +336,7 @@ impl ClientState {
|
||||||
PRIVMSG(ref target, ref body) => {
|
PRIVMSG(ref target, ref body) => {
|
||||||
if body.starts_with('\u{001}') {
|
if body.starts_with('\u{001}') {
|
||||||
let tokens: Vec<_> = {
|
let tokens: Vec<_> = {
|
||||||
let end = if body.ends_with('\u{001}') {
|
let end = if body.ends_with('\u{001}') && body.len() > 1 {
|
||||||
body.len() - 1
|
body.len() - 1
|
||||||
} else {
|
} else {
|
||||||
body.len()
|
body.len()
|
||||||
|
@ -1234,6 +1234,21 @@ mod test {
|
||||||
assert!(client.list_users("#test").is_none())
|
assert!(client.list_users("#test").is_none())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn handle_single_soh() {
|
||||||
|
let value = ":test!test@test PRIVMSG #test :\u{001}\r\n";
|
||||||
|
let client = IrcClient::from_config(Config {
|
||||||
|
mock_initial_value: Some(value.to_owned()),
|
||||||
|
nickname: Some(format!("test")),
|
||||||
|
channels: Some(vec![format!("#test"), format!("#test2")]),
|
||||||
|
..test_config()
|
||||||
|
}).unwrap();
|
||||||
|
client.for_each_incoming(|message| {
|
||||||
|
println!("{:?}", message);
|
||||||
|
}).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "ctcp")]
|
#[cfg(feature = "ctcp")]
|
||||||
fn finger_response() {
|
fn finger_response() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue