aatxe / irc

the irc crate – usable, async IRC for Rust
Mozilla Public License 2.0
528 stars 97 forks source link

Misparses USER into Raw, due to (deprecated) '*'? #160

Closed FauxFaux closed 5 years ago

FauxFaux commented 5 years ago

It appears that the USER command parser is not expecting the USER user 0 * :name format, and instead just USER user 0 :name. All clients I can find send the four-arg version of this, and both IRC specs list it.

It doesn't even round-trip through this crate:

#[test]
fn user_round_trip() {
    let cmd = Command::USER("a".to_string(), "b".to_string(), "c".to_string());
    let line = Message::from(cmd.clone()).to_string();
    let returned_cmd = line.parse::<Message>().unwrap().command;
    assert_eq!(cmd, returned_cmd);
}
  left: `USER("a", "b", "c")`,
 right: `Raw("USER", ["a", "b", "*"], Some("c"))`', src/proto/command.rs:1804:9

I'd expect to get the original USER object back from this round trip.