Skip to content

Commit

Permalink
Merge pull request #222 from squidowl/fix/allow-nickname-forward-slash
Browse files Browse the repository at this point in the history
Allow forward slash in nickname parsing
  • Loading branch information
casperstorm authored Jan 24, 2024
2 parents 857ea66 + 855096f commit 5d36c6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Changed:
Fixed:

- Accept '*' as a legal special symbol for usernames
- Accept '/' in usernames, ensuring correct parsing for bouncers using the nick/server convention


# 2023.5 (2023-11-12)

Expand Down
12 changes: 10 additions & 2 deletions irc/proto/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ fn space(input: &str) -> IResult<&str, ()> {
fn user(input: &str) -> IResult<&str, User> {
// <sequence of any characters except NUL, CR, LF, and SPACE> and @
let username = recognize(many1_count(none_of("\0\r\n @")));
// "-", "[", "]", "\", "`", "_", "^", "{", "|", "}", "*"
let special = one_of("-[]\\`_^{|}*");
// "-", "[", "]", "\", "`", "_", "^", "{", "|", "}", "*", "/"
let special = one_of("-[]\\`_^{|}*/");
// *( <letter> | <number> | <special> )
let nickname = recognize(many1_count(alt((
satisfy(|c| c.is_ascii_alphanumeric()),
Expand Down Expand Up @@ -197,6 +197,14 @@ mod test {
Source::Server("atw.hu.quakenet.org".into()),
),
(":*.freenode.net ", Source::Server("*.freenode.net".into())),
(
":foobar/[email protected] ",
Source::User(User {
nickname: "foobar/server".into(),
username: Some("~foobar".into()),
hostname: Some("555.555.555.555.abc.efg.com".into()),
}),
),
];

for (test, expected) in tests {
Expand Down

0 comments on commit 5d36c6c

Please sign in to comment.