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;
62 if (lc $f eq 'spotter') {
63 dbg("sh/dx by") if isdbg('sh/dx');
68 dbg("sh/dx qsl") if isdbg('sh/dx');
69 push @flist, "info {QSL|VIA}";
72 if (lc $f eq 'iota') {
74 if (@list && $list[0] && (($a, $b) = $list[0] =~ /(AF|AN|NA|SA|EU|AS|OC)-?(\d?\d\d)/oi)) {
76 $doiota = "\\b$a\[\-\ \]\?$b\\b";
79 $doiota = '\b(IOTA|(AF|AN|NA|SA|EU|AS|OC)[- ]?\d?\d\d)\b' unless $doiota;
80 push @flist, "info {$doiota}";
81 dbg("sh/dx iota") if isdbg('sh/dx');
85 my $doqra = uc shift @list if @list && $list[0] =~ /[A-Z][A-Z]\d\d/oi;
86 $doqra = '\b([A-Z][A-Z]\d\d|[A-Z][A-Z]\d\d[A-Z][A-Z])\b' unless $doqra;
87 push @flist, "info {$doqra}";
88 dbg("sh/dx qra") if isdbg('sh/dx');
91 if (grep {lc $f eq $_} qw(zone byzone by_zone itu byitu by_itu state bystate by_state info on) ) {
92 $f =~ s/^by(\w)/by_$1/;
94 push @flist, shift @list if @list;
106 $pre .= '*' unless $pre =~ /[\*\?\[]$/o;
107 $pre = shellregex($pre);
113 $pre .= '$' if $exact;
116 push @flist, 'call', $pre;
119 my $newline = join(' ', @flist);
120 dbg("sh/dx newline: $newline") if isdbg('sh/dx');
121 my ($r, $filter, $fno, $user, $expr) = $Spot::filterdef->parse($self, 'spots', $newline, 1);
123 return (0, "sh/dx parse error '$r' " . $filter) if $r;
125 dbg "sh/dx user: $user expr: $expr from: $from to: $to fromday: $fromday today: $today" if isdbg('sh/dx');
129 if ($self->{_nospawn}) {
130 my @res = Spot::search($expr, $fromday, $today, $from, $to, $user, $dofilter ? $self : undef);
133 foreach $ref (@res) {
134 if ($self && $self->ve7cc) {
135 push @out, VE7CC::dx_spot($self, @$ref);
138 if ($self && $real) {
139 push @out, DXCommandmode::format_dx_spot($self, @$ref);
142 push @out, Spot::formatl(@$ref);
148 push @out, $self->spawn_cmd("sh/dx $line", \&Spot::search,
149 args => [$expr, $fromday, $today, $from, $to, $filter, $dofilter ? $self : undef],
151 my ($dxchan, @res) = @_;
155 foreach $ref (@res) {
157 push @out, VE7CC::dx_spot($self, @$ref);
161 push @out, DXCommandmode::format_dx_spot($self, @$ref);
164 push @out, Spot::formatl(@$ref);
168 push @out, $self->msg('e3', "sh/dx", "'$line'") unless @out;