11 my ($self, $line) = @_;
12 my @list = split /\s+/, $line; # split the line up
16 my $call = $self->call;
17 my $usesql = $main::dbh && $Spot::use_db_for_search;
19 my ($fromday, $today);
30 while ($f = shift @list) { # next field
31 dbg "sh/dx arg: $f list: " . join(',', @list) if isdbg('sh/dx');
33 ($from, $to) = $f =~ m|^(\d+)[-/](\d+)$|; # is it a from -> to count?
34 dbg("sh/dx from: $from to: $to") if isdbg('sh/dx');
35 next if $from && $to > $from;
38 ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
39 dbg("sh/dx to: $to") if isdbg('sh/dx');
42 if (lc $f eq 'day' && $list[0]) {
43 ($fromday, $today) = split m|[-/]|, shift(@list);
44 dbg "sh/dx got day $fromday/$today" if isdbg('sh/dx');
47 if (lc $f eq 'exact') {
48 dbg("sh/dx exact") if isdbg('sh/dx');
52 if (lc $f eq 'rt' || $f =~ /^real/i) {
53 dbg("sh/dx real") if isdbg('sh/dx');
57 if (lc $f =~ /^filt/) {
58 dbg("sh/dx run spotfilter") if isdbg('sh/dx');
59 $dofilter = 1 if $self && $self->spotsfilter;
63 dbg("sh/dx qsl") if isdbg('sh/dx');
64 push @flist, "info {QSL|VIA}";
67 if (lc $f eq 'iota') {
69 if (@list && $list[0] && (($a, $b) = $list[0] =~ /(AF|AN|NA|SA|EU|AS|OC)-?(\d?\d\d)/oi)) {
71 $doiota = "\\b$a\[\-\ \]\?$b\\b";
74 $doiota = '\b(IOTA|(AF|AN|NA|SA|EU|AS|OC)[- ]?\d?\d\d)\b' unless $doiota;
75 push @flist, "info {$doiota}";
76 dbg("sh/dx iota") if isdbg('sh/dx');
80 my $doqra = uc shift @list if @list && $list[0] =~ /[A-Z][A-Z]\d\d/oi;
81 $doqra = '\b([A-Z][A-Z]\d\d|[A-Z][A-Z]\d\d[A-Z][A-Z])\b' unless $doqra;
82 push @flist, "info {$doqra}";
83 dbg("sh/dx qra") if isdbg('sh/dx');
86 if (grep {lc $f eq $_} qw(zone byzone by_zone itu byitu by_itu state bystate by_state info on spotter by) ) {
87 $f =~ s/^by(\w)/by_$1/;
89 push @flist, shift @list if @list;
101 $pre .= '*' unless $pre =~ /[\*\?\[]$/o;
102 $pre = shellregex($pre);
108 $pre .= '$' if $exact;
111 push @flist, 'call', $pre;
114 my $newline = join(' ', @flist);
115 dbg("sh/dx newline: $newline") if isdbg('sh/dx');
116 my ($r, $filter, $fno, $user, $expr) = $Spot::filterdef->parse($self, 'spots', $newline, 1);
118 return (0, "sh/dx parse error '$r' " . $filter) if $r;
120 dbg "sh/dx user: $user expr: $expr from: $from to: $to fromday: $fromday today: $today" if isdbg('sh/dx');
124 if ($self->{_nospawn}) {
125 my @res = Spot::search($expr, $fromday, $today, $from, $to, $user, $dofilter ? $self : undef);
128 foreach $ref (@res) {
129 if ($self && $self->ve7cc) {
130 push @out, VE7CC::dx_spot($self, @$ref);
133 if ($self && $real) {
134 push @out, DXCommandmode::format_dx_spot($self, @$ref);
137 push @out, Spot::formatl(@$ref);
143 push @out, $self->spawn_cmd("sh/dx $line", \&Spot::search,
144 args => [$expr, $fromday, $today, $from, $to, $filter, $dofilter ? $self : undef],
146 my ($dxchan, @res) = @_;
150 foreach $ref (@res) {
152 push @out, VE7CC::dx_spot($self, @$ref);
156 push @out, DXCommandmode::format_dx_spot($self, @$ref);
159 push @out, Spot::formatl(@$ref);
163 push @out, $self->msg('e3', "sh/dx", "'$line'") unless @out;