feat(unreal2): Add password rule check (#149)

* feat: add initial password checking

* feat: add password string check and made the field a bool

* chore: fix formatting

* feat: add password to has_password common response
This commit is contained in:
CosminPerRam 2023-11-09 01:18:52 +02:00 committed by GitHub
parent f01cac8fed
commit 0d27882150
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -167,10 +167,17 @@ impl Unreal2Protocol {
/// Make a full server query.
pub fn query(&mut self, gather_settings: &GatheringSettings) -> GDResult<Response> {
// Fetch the server info, this can only handle one response packet
let server_info = self.query_server_info()?;
let mut server_info = self.query_server_info()?;
let mutators_and_rules = if gather_settings.mutators_and_rules {
self.query_mutators_and_rules()?
let response = self.query_mutators_and_rules()?;
if let Some(password) = response.rules.get("GamePassword") {
let string = password.concat().to_lowercase();
server_info.password = string == "true";
}
response
} else {
MutatorsAndRules::default()
};