4 # this is where the fun starts!
6 # Copyright (c) 1998 Dirk Koopman G1TLH
11 my ($self, $line) = @_;
12 my @f = split /\s+/, $line, 3;
13 my $spotter = $self->call;
19 # do we have at least two args?
20 return (1, $self->msg('dx2')) unless @f >= 2;
22 # as a result of a suggestion by Steve K9AN, I am changing the syntax of
23 # 'spotted by' things to "dx by g1tlh <freq> <call>" <freq> and <call>
26 if ($f[0] =~ /^by$/i) {
28 $line =~ s/^\s*$f[0]\s+$f[1]\s+//;
30 @f = split /\s+/, $line;
31 return (1, $self->msg('dx2')) unless @f >= 2;
34 # get the freq and callsign either way round
35 if ($f[0] =~ /[A-Za-z]/) {
38 } elsif ($f[0] =~ /^[0-9\.\,]+$/) {
42 return (1, $self->msg('dx2'));
45 # make line the rest of the line
47 @f = split /\s+/, $line;
49 # bash down the list of bands until a valid one is reached
56 foreach $bandref (Bands::get_all()) {
57 @bb = @{$bandref->band};
58 for ($i = 0; $i < @bb; $i += 2) {
59 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
69 $freq = $freq * 1000 if $freq;
72 foreach $bandref (Bands::get_all()) {
73 @bb = @{$bandref->band};
74 for ($i = 0; $i < @bb; $i += 2) {
75 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
84 push @out, $self->msg('dx1', $freq) unless $valid;
86 # check we have a callsign :-)
87 if ($spotted le ' ') {
88 push @out, $self->msg('dx2');
93 return (1, @out) unless $valid;
95 # change ^ into : for transmission
98 # Store it here (but only if it isn't baddx)
99 if (grep $_ eq $spotted, @DXProt::baddx) {
100 my $buf = Spot::formatb($self->user->wantgrid, $freq, $spotted, $main::systime, $line, $spotter);
103 return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $main::systime, $line);
104 my @spot = Spot::add($freq, $spotted, $main::systime, $line, $spotter, $main::mycall);
106 # send orf to the users
107 DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot);