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 return (1, $self->msg('e5')) if $self->remotecmd;
20 return (1, $self->msg('e28')) unless $self->registered;
23 if (@bad = BadWords::check($line)) {
24 $self->badcount(($self->badcount||0) + @bad);
25 Log('DXCommand', "$self->{call} swore: $line");
29 # do we have at least two args?
30 return (1, $self->msg('dx2')) unless @f >= 2;
32 # as a result of a suggestion by Steve K9AN, I am changing the syntax of
33 # 'spotted by' things to "dx by g1tlh <freq> <call>" <freq> and <call>
36 if ($f[0] =~ /^by$/i) {
38 $line =~ s/^\s*\Q$f[0]\s+\Q$f[1]\s+//;
40 @f = split /\s+/, $line;
41 return (1, $self->msg('dx2')) unless @f >= 2;
44 # get the freq and callsign either way round
45 if (is_freq($f[1]) && $f[0] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) {
48 } elsif (is_freq($f[0]) && $f[1] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) {
52 return (1, $self->msg('dx3'));
55 # make line the rest of the line
57 @f = split /\s+/, $line;
59 # bash down the list of bands until a valid one is reached
66 foreach $bandref (Bands::get_all()) {
67 @bb = @{$bandref->band};
68 for ($i = 0; $i < @bb; $i += 2) {
69 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
79 $freq = $freq * 1000 if $freq;
82 foreach $bandref (Bands::get_all()) {
83 @bb = @{$bandref->band};
84 for ($i = 0; $i < @bb; $i += 2) {
85 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
94 push @out, $self->msg('dx1', $freq) unless $valid;
96 # check we have a callsign :-)
97 if ($spotted le ' ') {
98 push @out, $self->msg('dx2');
102 return (1, @out) unless $valid;
104 # Store it here (but only if it isn't baddx)
105 my $t = (int ($main::systime/60)) * 60;
106 return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line, $spotter);
107 my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall);
109 if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) {
111 # heaven forfend that we get a 69Mhz band :-)
112 if ($freq =~ /^69/) {
113 $self->badcount(($self->badcount||0) + 1);
116 $self->dx_spot(undef, undef, @spot);
123 # send orf to the users
124 DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot);