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;
18 return (1, $self->msg('e5')) if $self->remotecmd;
20 # do we have at least two args?
21 return (1, $self->msg('dx2')) unless @f >= 2;
23 # as a result of a suggestion by Steve K9AN, I am changing the syntax of
24 # 'spotted by' things to "dx by g1tlh <freq> <call>" <freq> and <call>
27 if ($f[0] =~ /^by$/i) {
29 $line =~ s/^\s*$f[0]\s+$f[1]\s+//;
31 @f = split /\s+/, $line;
32 return (1, $self->msg('dx2')) unless @f >= 2;
35 # get the freq and callsign either way round
36 if ($f[0] =~ /[A-Za-z]/) {
39 } elsif ($f[0] =~ /^[0-9\.\,]+$/) {
43 return (1, $self->msg('dx2'));
46 # make line the rest of the line
48 @f = split /\s+/, $line;
50 # bash down the list of bands until a valid one is reached
57 foreach $bandref (Bands::get_all()) {
58 @bb = @{$bandref->band};
59 for ($i = 0; $i < @bb; $i += 2) {
60 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
70 $freq = $freq * 1000 if $freq;
73 foreach $bandref (Bands::get_all()) {
74 @bb = @{$bandref->band};
75 for ($i = 0; $i < @bb; $i += 2) {
76 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
85 push @out, $self->msg('dx1', $freq) unless $valid;
87 # check we have a callsign :-)
88 if ($spotted le ' ') {
89 push @out, $self->msg('dx2');
94 return (1, @out) unless $valid;
97 if (@bad = BadWords::check($line)) {
98 return (1, $self->msg('e17', @bad));
101 # Store it here (but only if it isn't baddx)
102 if (grep $_ eq $spotted, @DXProt::baddx) {
103 my $buf = Spot::formatb($self->user->wantgrid, $freq, $spotted, $main::systime, $line, $spotter);
106 return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, (int ($main::systime/60)) * 60, $line);
107 my @spot = Spot::add($freq, $spotted, $main::systime, $line, $spotter, $main::mycall);
109 # send orf to the users
110 DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot);