- # local processing 1
- my $pcr;
- eval {
- $pcr = Local::pcprot($self, $pcno, @field);
- };
-# dbg('local', "Local::pcprot error $@") if $@;
- return if $pcr;
-
- SWITCH: {
- if ($pcno == 10) { # incoming talk
-
- # will we allow it at all?
- if ($censorpc) {
- my @bad;
- if (@bad = BadWords::check($field[3])) {
- dbg('chan', "Bad words: @bad, dropped" );
- return;
- }
- }
-
- # is it for me or one of mine?
- my ($to, $via, $call, $dxchan);
- if ($field[5] gt ' ') {
- $call = $via = $field[2];
- $to = $field[5];
- } else {
- $call = $to = $field[2];
- }
- $dxchan = DXChannel->get($call);
- if ($dxchan && $dxchan->is_user) {
- $field[3] =~ s/\%5E/^/g;
- $dxchan->talk($field[1], $to, $via, $field[3]);
- } else {
- $self->route($field[2], $line); # relay it on its way
- }
- return;
- }
-
- if ($pcno == 11 || $pcno == 26) { # dx spot
-
- # route 'foreign' pc26s
- if ($pcno == 26) {
- if ($field[7] ne $main::mycall) {
- $self->route($field[7], $line);
- return;
- }
- }
-
- # if this is a 'nodx' node then ignore it
- if (grep $field[7] =~ /^$_/, @DXProt::nodx_node) {
- dbg('chan', "Bad DXNode, dropped");
- return;
- }
-
- # convert the date to a unix date
- my $d = cltounix($field[3], $field[4]);
- # bang out (and don't pass on) if date is invalid or the spot is too old (or too young)
- if (!$d || ($pcno == 11 && ($d < $main::systime - $pc11_max_age || $d > $main::systime + 900))) {
- dbg('chan', "Spot ignored, invalid date or out of range ($field[3] $field[4])\n");
- return;
- }
-
- # is it 'baddx'
- if (grep $field[2] eq $_, @baddx) {
- dbg('chan', "Bad DX spot, ignored");
- return;
- }
-
- # do some de-duping
- $field[5] =~ s/^\s+//; # take any leading blanks off
- if (Spot::dup($field[1], $field[2], $d, $field[5])) {
- dbg('chan', "Duplicate Spot ignored\n");
- return;
- }
- if ($censorpc) {
- my @bad;
- if (@bad = BadWords::check($field[5])) {
- dbg('chan', "Bad words: @bad, dropped" );
- return;
- }
- }
-
- my @spot = Spot::add($field[1], $field[2], $d, $field[5], $field[6], $field[7]);
-
- #
- # @spot at this point contains:-
- # freq, spotted call, time, text, spotter, spotted cc, spotters cc, orig node
- # then spotted itu, spotted cq, spotters itu, spotters cq
- # you should be able to route on any of these
- #
-
- # fix up qra locators of known users
- my $user = DXUser->get_current($spot[4]);
- if ($user) {
- my $qra = $user->qra;
- unless ($qra && DXBearing::is_qra($qra)) {
- my $lat = $user->lat;
- my $long = $user->long;
- if (defined $lat && defined $long) {
- $user->qra(DXBearing::lltoqra($lat, $long));
- $user->put;
- }
- }
-
- # send a remote command to a distant cluster if it is visible and there is no
- # qra locator and we havn't done it for a month.
-
- unless ($user->qra) {
- my $node;
- my $to = $user->homenode;
- my $last = $user->lastoper || 0;
- if ($send_opernam && $main::systime > $last + $DXUser::lastoperinterval && $to && ($node = DXCluster->get_exact($to)) ) {
- my $cmd = "forward/opernam $spot[4]";
- # send the rcmd but we aren't interested in the replies...
- if ($node && $node->dxchan && $node->dxchan->is_clx) {
- route(undef, $to, pc84($main::mycall, $to, $main::mycall, $cmd));
- } else {
- route(undef, $to, pc34($main::mycall, $to, $cmd));
- }
- if ($to ne $field[7]) {
- $to = $field[7];
- $node = DXCluster->get_exact($to);
- if ($node && $node->dxchan && $node->dxchan->is_clx) {
- route(undef, $to, pc84($main::mycall, $to, $main::mycall, $cmd));
- } else {
- route(undef, $to, pc34($main::mycall, $to, $cmd));
- }
- }
- $user->lastoper($main::systime);
- $user->put;
- }
- }
- }
-
- # local processing
- my $r;
- eval {
- $r = Local::spot($self, @spot);
- };
-# dbg('local', "Local::spot1 error $@") if $@;
- return if $r;
-
- # DON'T be silly and send on PC26s!
- return if $pcno == 26;
-
- # send out the filtered spots
- send_dx_spot($self, $line, @spot) if @spot;
- return;