4 # this is where the fun starts!
6 # Copyright (c) 1998 Dirk Koopman G1TLH
11 my ($self, $line) = @_;
12 my @f = split /\s+/, $line;
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+//;
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'));
44 $line =~ s/^$f[0]\s+$f[1]\s*//;
46 # bash down the list of bands until a valid one is reached
53 foreach $bandref (Bands::get_all()) {
54 @bb = @{$bandref->band};
55 for ($i = 0; $i < @bb; $i += 2) {
56 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
66 $freq = $freq * 1000 if $freq;
69 foreach $bandref (Bands::get_all()) {
70 @bb = @{$bandref->band};
71 for ($i = 0; $i < @bb; $i += 2) {
72 if ($freq >= $bb[$i] && $freq <= $bb[$i+1]) {
81 push @out, $self->msg('dx1', $freq) unless $valid;
83 # check we have a callsign :-)
84 if ($spotted le ' ') {
85 push @out, $self->msg('dx2');
90 return (1, @out) unless $valid;
92 # change ^ into : for transmission
95 # Store it here (but only if it isn't baddx)
96 if (grep $_ eq $spotted, @DXProt::baddx) {
97 my $buf = Spot::formatb($freq, $spotted, $main::systime, $line, $spotter);
100 my @spot = Spot::add($freq, $spotted, $main::systime, $line, $spotter, $main::mycall);
102 # send orf to the users
103 DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot);