Skip to content

Commit

Permalink
Merge pull request #540 from squidowl/fix/allow-znc-nicknames
Browse files Browse the repository at this point in the history
ZNC Nickname Support for Outgoing Messages
  • Loading branch information
andymandias authored Sep 7, 2024
2 parents c24ab33 + be453ed commit c06eb9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

Fixed:

- Regression where messages sent to ZNC virtual users were routed to the wrong buffer (e.g. `*status` routed to `status`).

# 2024.11 (2024-09-04)

Added:
Expand Down
16 changes: 14 additions & 2 deletions data/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ impl<'a> TryFrom<&'a str> for User {
return Err("nickname can't be empty");
}

let Some(index) = value.find(|c: char| c.is_alphabetic() || "[\\]^_`{|}".find(c).is_some())
let Some(index) =
value.find(|c: char| c.is_alphabetic() || "[\\]^_`{|}*".find(c).is_some())
else {
return Err("nickname must start with alphabetic or [ \\ ] ^ _ ` { | }");
return Err("nickname must start with alphabetic or [ \\ ] ^ _ ` { | } *");
};

let (access_levels, rest) = (&value[..index], &value[index..]);
Expand Down Expand Up @@ -522,6 +523,17 @@ mod tests {
away: false,
},
),
(
"*status",
User {
nickname: "*status".into(),
username: None,
hostname: None,
accountname: None,
access_levels: HashSet::<AccessLevel>::new(),
away: false,
},
),
];

for (test, expected) in tests {
Expand Down

0 comments on commit c06eb9b

Please sign in to comment.