diff --git a/src/channels.rs b/src/channels.rs index e856862..18f4fec 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -1455,10 +1455,10 @@ pub fn normalize_ban_mask(m: &str) -> String { let b = m.as_bytes(); if b.len() >= 2 && b[1] == b':' && (b[0] as char).is_ascii_alphabetic() { // These extbans carry a name / spec / channel / server, not a host mask, - // so they must not be host-normalised: g: (security group), y: (reputation - // score), r: (realname), j: (channel), s: (server name), G: (country), - // b: (banned-in-channel). - if matches!(b[0], b'g' | b'y' | b'r' | b'j' | b's' | b'G' | b'b') { + // so they must not be host-normalised: a: (account), g: (security group), + // y: (reputation score), r: (realname), j: (channel), s: (server name), + // G: (country), b: (banned-in-channel). + if matches!(b[0], b'a' | b'g' | b'y' | b'r' | b'j' | b's' | b'G' | b'b') { return m.to_string(); } return format!("{}:{}", &m[..1], normalize_mask(&m[2..])); @@ -1470,6 +1470,14 @@ pub fn normalize_ban_mask(m: &str) -> String { mod tests { use super::*; + #[test] + fn account_extban_mask_is_left_verbatim() { + // a: carries an account name, not a host mask — must not gain !*@* + assert_eq!(normalize_ban_mask("a:someacct*"), "a:someacct*"); + // a bare nick is still host-normalised the usual way + assert!(normalize_ban_mask("bob").contains('@')); + } + #[test] fn member_rank_and_prefix_char_take_the_highest() { let mut m = Member::default();