easydns: Whitespace fixes

This commit is contained in:
Richard Hansen 2024-07-20 02:13:13 -04:00
parent c57f4b0d56
commit e7ad0e8e6e

View file

@ -4797,12 +4797,9 @@ sub nic_easydns_update {
for my $h (@_) { for my $h (@_) {
my $ipv4 = delete $config{$h}{'wantipv4'}; my $ipv4 = delete $config{$h}{'wantipv4'};
my $ipv6 = delete $config{$h}{'wantipv6'}; my $ipv6 = delete $config{$h}{'wantipv6'};
info("setting IP address to %s %s for %s", $ipv4, $ipv6, $h); info("setting IP address to %s %s for %s", $ipv4, $ipv6, $h);
verbose("UPDATE:", "updating %s", $h); verbose("UPDATE:", "updating %s", $h);
#'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON'
my $url; my $url;
$url = "https://$config{$h}{'server'}$config{$h}{'script'}?"; $url = "https://$config{$h}{'server'}$config{$h}{'script'}?";
$url .= "hostname=$h"; $url .= "hostname=$h";
@ -4813,12 +4810,10 @@ sub nic_easydns_update {
$url .= $ipv6a $url .= $ipv6a
} }
$url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') if defined $config{$h}{'wildcard'}; $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') if defined $config{$h}{'wildcard'};
if ($config{$h}{'mx'}) { if ($config{$h}{'mx'}) {
$url .= "&mx=$config{$h}{'mx'}"; $url .= "&mx=$config{$h}{'mx'}";
$url .= "&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO'); $url .= "&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO');
} }
my $reply = geturl( my $reply = geturl(
proxy => opt('proxy'), proxy => opt('proxy'),
url => $url, url => $url,
@ -4830,21 +4825,16 @@ sub nic_easydns_update {
next; next;
} }
next if !header_ok($h, $reply); next if !header_ok($h, $reply);
my @reply = split /\n/, $reply; my @reply = split /\n/, $reply;
my $state = 'header'; my $state = 'header';
for my $line (@reply) { for my $line (@reply) {
if ($state eq 'header') { if ($state eq 'header') {
$state = 'body'; $state = 'body';
} elsif ($state eq 'body') { } elsif ($state eq 'body') {
$state = 'results' if $line eq ''; $state = 'results' if $line eq '';
} elsif ($state =~ /^results/) { } elsif ($state =~ /^results/) {
$state = 'results2'; $state = 'results2';
my ($status) = $line =~ /^(\S*)\b.*/; my ($status) = $line =~ /^(\S*)\b.*/;
$config{$h}{'status-ipv4'} = $status if $ipv4; $config{$h}{'status-ipv4'} = $status if $ipv4;
$config{$h}{'status-ipv6'} = $status if $ipv6; $config{$h}{'status-ipv6'} = $status if $ipv6;
if ($status eq 'NOERROR') { if ($status eq 'NOERROR') {
@ -4852,21 +4842,17 @@ sub nic_easydns_update {
$config{$h}{'ipv6'} = $ipv6; $config{$h}{'ipv6'} = $ipv6;
$config{$h}{'mtime'} = $now; $config{$h}{'mtime'} = $now;
success("updating %s: %s: IP address set to %s %s", $h, $status, $ipv4, $ipv6); success("updating %s: %s: IP address set to %s %s", $h, $status, $ipv4, $ipv6);
} elsif ($status =~ /TOOSOON/) { } elsif ($status =~ /TOOSOON/) {
## make sure we wait at least a little ## make sure we wait at least a little
my ($wait, $units) = (5, 'm'); my ($wait, $units) = (5, 'm');
my ($sec, $scale) = ($wait, 1); my ($sec, $scale) = ($wait, 1);
($scale, $units) = (1, 'seconds') if $units eq 's'; ($scale, $units) = (1, 'seconds') if $units eq 's';
($scale, $units) = (60, 'minutes') if $units eq 'm'; ($scale, $units) = (60, 'minutes') if $units eq 'm';
($scale, $units) = (60*60, 'hours') if $units eq 'h'; ($scale, $units) = (60*60, 'hours') if $units eq 'h';
$config{$h}{'wtime'} = $now + $sec; $config{$h}{'wtime'} = $now + $sec;
warning("updating %s: %s: wait %d %s before further updates", $h, $status, $wait, $units); warning("updating %s: %s: wait %d %s before further updates", $h, $status, $wait, $units);
} elsif (exists $errors{$status}) { } elsif (exists $errors{$status}) {
failed("updating %s: %s: %s", $h, $line, $errors{$status}); failed("updating %s: %s: %s", $h, $line, $errors{$status});
} else { } else {
failed("updating %s: unexpected status (%s)", $h, $line); failed("updating %s: unexpected status (%s)", $h, $line);
} }