use strict;
use vars qw($me $pc11_max_age $pc23_max_age
$last_hour %pings %rcmds
- %nodehops @baddx $baddxfn
+ %nodehops @baddx $baddxfn $censorpc
$allowzero $decode_dk0wcy $send_opernam @checklist);
$me = undef; # the channel id for this cluster
%rcmds = (); # outstanding rcmd requests outbound
%nodehops = (); # node specific hop control
@baddx = (); # list of illegal spotted callsigns
-
+$censorpc = 0; # Do a BadWords::check on text fields and reject things
$baddxfn = "$main::data/baddx.pl";
[ qw(c c n n) ], # pc25
[ qw(f m d t m c c bc) ], # pc26
[ qw(d n n n n m c c bc) ], # pc27
- [ qw(c c c c d t p m bp n p bp bc) ], # pc28
+ [ qw(c c m c d t p m bp n p bp bc) ], # pc28
[ qw(c c n m) ], # pc29
[ qw(c c n) ], # pc30
[ qw(c c n) ], # pc31
confess $@ if $@;
$me->{sort} = 'S'; # S for spider
- # now prime the spot and wwv duplicates file with data
-# my @today = Julian::unixtoj(time);
-# for (Spot::readfile(@today), Spot::readfile(Julian::sub(@today, 1))) {
-# Spot::dup(@{$_}[0..3]);
-# }
-# for (Geomag::readfile(time)) {
-# Geomag::dup(@{$_}[1..5]);
-# }
-
# load the baddx file
do "$baddxfn" if -e "$baddxfn";
print "$@\n" if $@;
$self->{consort} = $line; # save the connection type
$self->{here} = 1;
+ # get the output filters
+ $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0);
+ $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0);
+ $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0);
+ $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ;
+
+
# get the INPUT filters (these only pertain to Clusters)
- $self->{inspotfilter} = Filter::read_in('spots', $call, 1);
- $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1);
- $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1);
- $self->{inannfilter} = Filter::read_in('ann', $call, 1);
+ $self->{inspotsfilter} = Filter::read_in('spots', $call, 1) || Filter::read_in('spots', 'node_default', 1);
+ $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1);
+ $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1);
+ $self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1);
# set unbuffered and no echo
$self->send_now('B',"0");
if ($pcno == 10) { # incoming talk
# will we allow it at all?
- my @bad;
- if (@bad = BadWords::check($field[3])) {
- dbg('chan', "Bad words: @bad, dropped" );
- return;
+ 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?
dbg('chan', "Duplicate Spot ignored\n");
return;
}
- my @bad;
- if (@bad = BadWords::check($field[5])) {
- dbg('chan', "Bad words: @bad, dropped" );
- 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]);
return;
}
- my @bad;
- if (@bad = BadWords::check($field[3])) {
- dbg('chan', "Bad words: @bad, dropped" );
- return;
+ if ($censorpc) {
+ my @bad;
+ if (@bad = BadWords::check($field[3])) {
+ dbg('chan', "Bad words: @bad, dropped" );
+ return;
+ }
}
+
if ($field[2] eq '*' || $field[2] eq $main::mycall) {
# global ann filtering on INPUT
if ($self->{inannfilter}) {
- my ($filter, $hops) = Filter::it($self->{inannfilter}, @field[1..6], $self->{call} );
+ my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
+ my @dxcc = Prefix::extract($field[1]);
+ if (@dxcc > 0) {
+ $ann_dxcc = $dxcc[1]->dxcc;
+ $ann_itu = $dxcc[1]->itu;
+ $ann_cq = $dxcc[1]->cq();
+ }
+ @dxcc = Prefix::extract($field[5]);
+ if (@dxcc > 0) {
+ $org_dxcc = $dxcc[1]->dxcc;
+ $org_itu = $dxcc[1]->itu;
+ $org_cq = $dxcc[1]->cq();
+ }
+ my ($filter, $hops) = $self->{inannfilter}->it(@field[1..6], $self->{call},
+ $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
unless ($filter) {
dbg('chan', "Rejected by filter");
return;
my $routeit;
my ($filter, $hops);
- if ($dxchan->{spotfilter}) {
- ($filter, $hops) = Filter::it($dxchan->{spotfilter}, @_, $self->{call} );
+ if ($dxchan->{spotsfilter}) {
+ ($filter, $hops) = $dxchan->{spotsfilter}->it(@_, $self->{call} );
next unless $filter;
}
my ($filter, $hops);
if ($dxchan->{wwvfilter}) {
- ($filter, $hops) = Filter::it($dxchan->{wwvfilter}, @_, $self->{call} );
+ ($filter, $hops) = $dxchan->{wwvfilter}->it(@_, $self->{call} );
next unless $filter;
}
if ($dxchan->is_node) {
my ($filter, $hops);
if ($dxchan->{wcyfilter}) {
- ($filter, $hops) = Filter::it($dxchan->{wcyfilter}, @_, $self->{call} );
+ ($filter, $hops) = $dxchan->{wcyfilter}->it(@_, $self->{call} );
next unless $filter;
}
- if ($dxchan->is_clx || $dxchan->is_spider) {
+ if ($dxchan->is_clx || $dxchan->is_spider || $dxchan->is_dxnet) {
next if $dxchan == $self;
if ($hops) {
$routeit = $line;
my ($filter, $hops);
if ($dxchan->{annfilter}) {
- ($filter, $hops) = Filter::it($dxchan->{annfilter}, @_, $self->{call} );
+ my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
+ my @dxcc = Prefix::extract($_[0]);
+ if (@dxcc > 0) {
+ $ann_dxcc = $dxcc[1]->dxcc;
+ $ann_itu = $dxcc[1]->itu;
+ $ann_cq = $dxcc[1]->cq;
+ }
+ @dxcc = Prefix::extract($_[4]);
+ if (@dxcc > 0) {
+ $org_dxcc = $dxcc[1]->dxcc;
+ $org_itu = $dxcc[1]->itu;
+ $org_cq = $dxcc[1]->cq;
+ }
+ ($filter, $hops) = $dxchan->{annfilter}->it(@_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
next unless $filter;
}
if ($dxchan->is_node && $_[1] ne $main::mycall) { # i.e not specifically routed to me
sub route
{
my ($self, $call, $line) = @_;
- my $cl = DXCluster->get_exact($call);
- if ($cl) { # don't route it back down itself
- if (ref $self && $call eq $self->{call}) {
- dbg('chan', "Trying to route back to source, dropped");
- return;
- }
- my $hops;
- my $dxchan = $cl->{dxchan};
- if ($dxchan) {
- my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
- if ($routeit) {
- $dxchan->send($routeit) if $dxchan;
- }
+
+ if (ref $self && $call eq $self->{call}) {
+ dbg('chan', "Trying to route back to source, dropped");
+ return;
+ }
+
+ # always send it down the local interface if available
+ my $dxchan = DXChannel->get($call);
+ unless ($dxchan) {
+ my $cl = DXCluster->get_exact($call);
+ $dxchan = $cl->dxchan if $cl;
+ }
+ if ($dxchan) {
+ my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
+ if ($routeit) {
+ $dxchan->send($routeit);
}
}
}
if ($sort eq 'dx') {
next unless $dxchan->{dx};
- ($filter) = Filter::it($dxchan->{spotfilter}, @{$fref}) if ref $fref;
+ ($filter) = $dxchan->{spotsfilter}->it(@{$fref}) if ref $fref;
next unless $filter;
}
next if $sort eq 'ann' && !$dxchan->{ann};