- $doiota = '\b(IOTA|(AF|AN|NA|SA|EU|AS|OC)[- ]?\d?\d\d)\b' unless $doiota;
- next;
- }
- if (lc $f eq 'qra') {
- $doqra = uc shift @list if @list && $list[0] =~ /[A-Z][A-Z]\d\d/oi;
- $doqra = '\b([A-Z][A-Z]\d\d|[A-Z][A-Z]\d\d[A-Z][A-Z])\b' unless $doqra;
- next;
- }
- if (lc $f eq 'zone') {
- $zone = shift @list if @list;
- next;
- }
- if (lc $f =~ /^by_?zone/) {
- $byzone = shift @list if @list;
- next;
- }
- if (lc $f eq 'itu') {
- $itu = shift @list if @list;
- next;
- }
- if (lc $f =~ /^by_?itu/) {
- $byitu = shift @list if @list;
- next;
- }
- if (lc $f eq 'state') {
- $state = uc shift @list if @list;
- next;
- }
- if (lc $f =~ /^by_?state/) {
- $bystate = uc shift @list if @list;
- next;
- }
- if (!$pre) {
- $pre = uc $f;
- }
-}
-
-#$DB::single = 1;
-
-# check origin
-if ($origin) {
- $expr .= ' && ' if $expr;
- $expr .= "\$f7 eq '$origin'";
- $hint .= ' && ' if $hint;
- $hint .= "m{$origin}";
-}
-
-# check (any) ip address
-if ($ip) {
- $expr .= ' && ' if $expr;
- $expr .= "\$f14 && \$f14 =~ m{^$ip}";
- $hint .= ' && ' if $hint;
- $ip =~ s/\./\\./g; # IPV4
- $hint .= "m{$ip}";
-}
-
-# deal with the prefix
-if ($pre) {
- my @ans;
-
- if ($dxcc) {
- @ans = Prefix::extract($pre); # is it a callsign/prefix?
-
- if (@ans) {
-
- # first deal with the prefix
- my $pre = shift @ans;
- my $a;
- my $str = "Prefix: $pre";
- my $l = length $str;
- my @expr;
- my @hint;
-
- # build up a search string for this dxcc country/countries
- foreach $a (@ans) {
- my $n = $a->dxcc();
- push @expr, "\$f5 == $n";
- push @hint, "m{$n}";
- my $name = $a->name();
- $str .= " Dxcc: $n ($name)";
- push @out, $str;
- $str = ' ' x $l;
- }
- $expr = @expr > 1 ? '(' . join(' || ', @expr) . ')' : $expr[0];
- $hint = @hint > 1 ? '(' . join(' || ', @hint) . ')' : $hint[0];