Browse Source

Remove filter flag `white`

ipv6
Denis Drakhnia 1 year ago
parent
commit
7ffa5b5d42
  1. 26
      src/filter.rs

26
src/filter.rs

@ -25,14 +25,12 @@ bitflags! {
const FULL = 1 << 4; const FULL = 1 << 4;
/// Servers that are empty /// Servers that are empty
const NOPLAYERS = 1 << 5; const NOPLAYERS = 1 << 5;
/// Servers that are whitelisted
const WHITE = 1 << 6;
/// Servers that are behind NAT /// Servers that are behind NAT
const NAT = 1 << 7; const NAT = 1 << 6;
/// Servers that are LAN /// Servers that are LAN
const LAN = 1 << 8; const LAN = 1 << 7;
/// Servers that has bots /// Servers that has bots
const BOTS = 1 << 9; const BOTS = 1 << 8;
} }
} }
@ -138,7 +136,6 @@ impl<'a> ParseValue<'a> for Filter<'a> {
b"full" => filter.insert_flag(FilterFlags::FULL, p.parse()?), b"full" => filter.insert_flag(FilterFlags::FULL, p.parse()?),
b"password" => filter.insert_flag(FilterFlags::PASSWORD, p.parse()?), b"password" => filter.insert_flag(FilterFlags::PASSWORD, p.parse()?),
b"noplayers" => filter.insert_flag(FilterFlags::NOPLAYERS, p.parse()?), b"noplayers" => filter.insert_flag(FilterFlags::NOPLAYERS, p.parse()?),
b"white" => filter.insert_flag(FilterFlags::WHITE, p.parse()?),
b"name_match" => filter.name_match = Some(p.parse()?), b"name_match" => filter.name_match = Some(p.parse()?),
b"version_match" => filter.version_match = Some(p.parse()?), b"version_match" => filter.version_match = Some(p.parse()?),
b"gameaddr" => { b"gameaddr" => {
@ -268,12 +265,6 @@ mod tests {
flags: FilterFlags::NOPLAYERS, flags: FilterFlags::NOPLAYERS,
} }
} }
parse_white(flags_mask: FilterFlags::WHITE) {
b"\\white\\0" => {}
b"\\white\\1" => {
flags: FilterFlags::WHITE,
}
}
parse_nat(flags_mask: FilterFlags::NAT) { parse_nat(flags_mask: FilterFlags::NAT) {
b"\\nat\\0" => {} b"\\nat\\0" => {}
b"\\nat\\1" => { b"\\nat\\1" => {
@ -458,17 +449,6 @@ mod tests {
matches!(servers, b"\\bots\\1", 2); matches!(servers, b"\\bots\\1", 2);
} }
#[test]
fn match_white() {
let servers = servers! {
"0.0.0.0:0" => b""
"0.0.0.0:0" => b"" => |s| { s.flags |= FilterFlags::WHITE; }
};
matches!(servers, b"", 0, 1);
matches!(servers, b"\\white\\0", 0);
matches!(servers, b"\\white\\1", 1);
}
#[test] #[test]
fn match_gamedir() { fn match_gamedir() {
let servers = servers! { let servers = servers! {

Loading…
Cancel
Save