mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
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:
parent
f01cac8fed
commit
0d27882150
2 changed files with 17 additions and 6 deletions
|
|
@ -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()
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue