my $self = shift;
my $cmdline = shift;
my @ans;
+ my @bad;
# save this for them's that need it
my $rawline = $cmdline;
} elsif ($cmdline =~ m|^/+\w+|) {
$cmdline =~ s|^/||;
my $sendit = $cmdline =~ s|^/+||;
- my @in = $self->run_cmd($cmdline);
- $self->send_ans(@in);
- if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
- foreach my $l (@in) {
- my @bad;
- if (@bad = BadWords::check($l)) {
- $self->badcount(($self->badcount||0) + @bad);
- LogDbg('DXCommand', "$self->{call} swore: $l with words:" . join(',', @bad) . ")");
- } else {
+ if (@bad = BadWords::check($cmdline)) {
+ $self->badcount(($self->badcount||0) + @bad);
+ LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with words: '" . join(',', @bad) . "'");
+ } else {
+ my @in = $self->run_cmd($cmdline);
+ $self->send_ans(@in);
+ if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
+ foreach my $l (@in) {
for (@{$self->{talklist}}) {
if ($self->{state} eq 'talk') {
$self->send_talks($_, $l);
$self->send($self->{state} eq 'talk' ? $self->talk_prompt : $self->chat_prompt);
} elsif ($self->{talklist} && @{$self->{talklist}}) {
# send what has been said to whoever is in this person's talk list
- my @bad;
if (@bad = BadWords::check($cmdline)) {
$self->badcount(($self->badcount||0) + @bad);
- LogDbg('DXCommand', "$self->{call} swore: $cmdline with words:" . join(',', @bad) . ")");
+ LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with words: '" . join(',', @bad) . "'");
} else {
for (@{$self->{talklist}}) {
if ($self->{state} eq 'talk') {
}
$self->send_ans(@ans);
} else {
- $self->send_ans(run_cmd($self, $cmdline));
+ if (@bad = BadWords::check($cmdline)) {
+ $self->badcount(($self->badcount||0) + @bad);
+ LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with words: '" . join(',', @bad) . "'");
+ } else {
+ $self->send_ans(run_cmd($self, $cmdline));
+ }
}
# check for excessive swearing
my @bad;
if (@bad = BadWords::check($pc->[3])) {
my $bw = join ', ', @bad;
- dbg("PCPROT: Bad words: '$bw', dropped");
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Badwords: '$bw', dropped");
return;
}
}
# if this is a 'nodx' node then ignore it
if ($badnode->in($pc->[6]) || ($via && $badnode->in($via))) {
- dbg("PCPROT: Bad Node, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Node, dropped");
return;
}
my $nossid = $from;
$nossid =~ s/-\d+$//;
if ($badspotter->in($nossid)) {
- dbg("PCPROT: Bad Spotter, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Spotter, dropped");
return;
}
# is the spotted callsign blank? This should really be trapped earlier but it
# could break other protocol sentences. Also check for lower case characters.
if ($pc->[2] =~ /^\s*$/) {
- dbg("PCPROT: blank callsign, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: blank callsign, dropped");
return;
}
if ($pc->[2] =~ /[a-z]/) {
- dbg("PCPROT: lowercase characters, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: lowercase characters, dropped");
return;
}
# if this is a 'nodx' node then ignore it
if ($badnode->in($pc->[7])) {
- dbg("PCPROT: Bad Node $pc->[7], dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Node $pc->[7], dropped");
return;
}
my $nossid = $pc->[6];
$nossid =~ s/-\d+$//;
if ($badspotter->in($nossid)) {
- dbg("PCPROT: Bad Spotter $pc->[6], dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Spotter $pc->[6], dropped");
return;
}
my $d = cltounix($pc->[3], $pc->[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 || $pcno == 61) && ($d < $main::systime - $pc11_max_age || $d > $main::systime + 900))) {
- dbg("PCPROT: Spot ignored, invalid date or out of range ($pc->[3] $pc->[4])\n") if isdbg('chanerr');
+ dbg("PCPROT: Spot ignored, invalid date or out of range ($pc->[3] $pc->[4])\n");
return;
}
if ($baddx->in($pc->[2]) || (my @bad = BadWords::check($pc->[2]))) {
my $bw = join ', ', @bad;
$bw = qq{ '$bw'} if $bw;
- dbg("PCPROT: Bad DX spot$bw, ignored") if isdbg('chanerr');
+ dbg("PCPROT: Bad DX spot$bw, ignored");
return;
}
my @bad;
if (@bad = BadWords::check($pc->[5])) {
my $bw = join ', ', @bad;
- dbg("PCPROT: Bad words: '$bw', dropped");
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Badwords: '$bw', dropped");
return;
}
}
my @bad;
if (@bad = BadWords::check($pc->[3])) {
my $bw = join ', ', @bad;
- dbg("PCPROT: Bad words: '$bw', dropped");
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Badwords: '$bw', dropped");
return;
}
}
# if this is a 'nodx' node then ignore it
if ($badnode->in($pc->[5])) {
- dbg("PCPROT: Bad Node, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Node, dropped");
return;
}
my $nossid = $pc->[1];
$nossid =~ s/-\d+$//;
if ($badspotter->in($nossid)) {
- dbg("PCPROT: Bad Spotter, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Spotter, dropped");
return;
}
my @bad;
if (@bad = BadWords::check($text)) {
my $bw = join ', ', @bad;
- dbg("PCPROT: Bad words: '$bw', dropped");
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Badwords: '$bw', dropped");
return;
}
}
my $nossid = $from;
$nossid =~ s/-\d+$//;
if ($badspotter->in($nossid)) {
- dbg("PCPROT: Bad Spotter, dropped") if isdbg('chanerr');
+ dbg($line) if isdbg('nologchan');
+ dbg("PCPROT: Bad Spotter, dropped");
return;
}