godaddy: Invert conditional to improve readability
This commit is contained in:
parent
b1c0029604
commit
6e98c0cdb2
1 changed files with 28 additions and 27 deletions
17
ddclient.in
17
ddclient.in
|
@ -5768,7 +5768,6 @@ sub nic_godaddy_update {
|
|||
}
|
||||
(my $code) = ($reply =~ m%^s*HTTP/.*\s+(\d+)%i);
|
||||
my $ok = header_ok($h, $reply);
|
||||
my $msg;
|
||||
$reply =~ s/^.*?\n\n//s;
|
||||
my $response = eval {decode_json($reply)};
|
||||
if (!defined($response)) {
|
||||
|
@ -5777,13 +5776,9 @@ sub nic_godaddy_update {
|
|||
} elsif (defined($response->{code})) {
|
||||
info("$h: $response->{code} - $response->{message}");
|
||||
}
|
||||
if ($ok) {
|
||||
$config{$h}{"ipv$ipv"} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{"status-ipv$ipv"} = 'good';
|
||||
success("$h: Updated successfully to $ip (status: $code)");
|
||||
next;
|
||||
} elsif ($code == "400") {
|
||||
if (!$ok) {
|
||||
my $msg;
|
||||
if ($code == "400") {
|
||||
$msg = 'GoDaddy API URL ($url) was malformed.';
|
||||
} elsif ($code == "401") {
|
||||
if ($config{$h}{'login'} && $config{$h}{'login'}) {
|
||||
|
@ -5806,6 +5801,12 @@ sub nic_godaddy_update {
|
|||
$msg = 'Unexpected service response.';
|
||||
}
|
||||
failed("$h: $msg");
|
||||
next;
|
||||
}
|
||||
$config{$h}{"ipv$ipv"} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{"status-ipv$ipv"} = 'good';
|
||||
success("$h: Updated successfully to $ip (status: $code)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue