From cbf3c0cd90df4c4df05dae6a00d03f7f9482d631 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 7 Jan 2006 16:53:03 +0000 Subject: [PATCH] fix swearing logging so that it is better. fix badspotters being able to send dx spots. add LogDbg() routine to both log and dbg at the same time (at last). --- Changes | 4 ++++ cmd/announce.pl | 2 +- cmd/chat.pl | 2 +- cmd/dx.pl | 24 +++++++++++++++++++++--- cmd/talk.pl | 2 +- perl/DXCommandmode.pm | 4 ++-- perl/DXLog.pm | 8 +++++++- perl/DXMsg.pm | 17 +++++++++++------ 8 files changed, 48 insertions(+), 15 deletions(-) diff --git a/Changes b/Changes index 7a72d807..fdc64510 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,10 @@ 1. Fixed problem with the standalone 'showdx' program pointed out by Leo, IZ5FSA. 2. Fixed rounding problem on entering spots as pointed out by Ron N5IN. +3. Fixed problem with badspotters sending DX as pointed out by Luigi IK5ZUK. +4. Added some extra logging for swearing so that we can see what lines used +which swear words. Hopefully this will allow sysops to refine their swearing +filters more easily. 06Jan06======================================================================= 1. Fix problem with rcmd sh/fdx 27Dec05======================================================================= diff --git a/cmd/announce.pl b/cmd/announce.pl index 5e0ff58c..9a1cbd37 100644 --- a/cmd/announce.pl +++ b/cmd/announce.pl @@ -51,7 +51,7 @@ $line =~ s/\^/:/og; my @bad; if (@bad = BadWords::check($line)) { $self->badcount(($self->badcount||0) + @bad); - Log('DXCommand', "$self->{call} swore: $line"); + LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")"); Log('ann', $to, $from, "[to $from only] $line"); $self->send("To $to de $from <$t>: $line"); return (1, ()); diff --git a/cmd/chat.pl b/cmd/chat.pl index cace4508..41cbb5ca 100644 --- a/cmd/chat.pl +++ b/cmd/chat.pl @@ -29,7 +29,7 @@ $line =~ s/\^/:/og; my @bad; if (@bad = BadWords::check($line)) { $self->badcount(($self->badcount||0) + @bad); - Log('DXCommand', "$self->{call} swore: $line"); + LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")"); Log('chat', $target, $from, "[to $from only] $line"); return (1, "$target de $from <$t>: $line"); } diff --git a/cmd/dx.pl b/cmd/dx.pl index 02fc3ca4..9454fd70 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -22,8 +22,8 @@ return (1, $self->msg('e28')) unless $self->registered; my @bad; if (@bad = BadWords::check($line)) { $self->badcount(($self->badcount||0) + @bad); - Log('DXCommand', "$self->{call} swore: $line"); - $localonly++; + LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")"); + $localonly++; } # do we have at least two args? @@ -53,6 +53,24 @@ if (is_freq($f[1]) && $f[0] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) { return (1, $self->msg('dx3')); } +# check some other things +# remove ssid from calls +my $callnoid = $self->call; +$callnoid =~ s/-\d+$//; +my $spotternoid = $spotter; +$spotternoid =~ s/-\d+$//; +if ($DXProt::baddx->in($spotted)) { + $localonly++; +} +if ($DXProt::badspotter->in($callnoid)) { + LogDbg('DXCommand', "$self->{call} badspotter with $callnoid ($line)"); + $localonly++; +} +if ($callnoid ne $spotternoid && $DXProt::badspotter->in($spotternoid)) { + LogDbg('DXCommand', "$self->{call} badspotter with $spotternoid ($line)"); + $localonly++; +} + # make line the rest of the line $line = $f[2] || " "; @f = split /\s+/, $line; @@ -107,7 +125,7 @@ my $t = (int ($main::systime/60)) * 60; return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line, $spotter); my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall); -if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) { +if ($freq =~ /^69/ || $localonly) { # heaven forfend that we get a 69Mhz band :-) if ($freq =~ /^69/) { diff --git a/cmd/talk.pl b/cmd/talk.pl index 2815ad39..66d3cd2c 100644 --- a/cmd/talk.pl +++ b/cmd/talk.pl @@ -42,7 +42,7 @@ if ($line) { my @bad; if (@bad = BadWords::check($line)) { $self->badcount(($self->badcount||0) + @bad); - Log('DXCommand', "$self->{call} swore: $line"); + LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")"); } else { $dxchan->talk($self->call, $to, $via, $line) if $dxchan; } diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 04a1b286..29840c41 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -311,7 +311,7 @@ sub normal my @bad; if (@bad = BadWords::check($cmdline)) { $self->badcount(($self->badcount||0) + @bad); - Log('DXCommand', "$self->{call} swore: $cmdline"); + LogDbg('DXCommand', "$self->{call} swore: $cmdline with words:" . join(',', @bad) . ")"); } else { for (@{$self->{talklist}}) { $self->send_talks($_, $rawline); @@ -343,7 +343,7 @@ sub normal # check for excessive swearing if ($self->{badcount} && $self->{badcount} >= $maxbadcount) { - Log('DXCommand', "$self->{call} logged out for excessive swearing"); + LogDbg('DXCommand', "$self->{call} logged out for excessive swearing"); $self->disconnect; return; } diff --git a/perl/DXLog.pm b/perl/DXLog.pm index f96ab44a..78548353 100644 --- a/perl/DXLog.pm +++ b/perl/DXLog.pm @@ -27,7 +27,7 @@ package DXLog; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(Log Logclose); +@EXPORT = qw(Log LogDbg Logclose); use IO::File; use DXVars; @@ -204,6 +204,12 @@ sub Log $log->writeunix($t, join('^', $t, @_) ); } +sub LogDbg +{ + DXDebug::dbg($_[$#_]); + Log(@_); +} + sub Logclose { $log->close(); diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index b25b70a5..f4a1b7ab 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -346,17 +346,22 @@ sub handle_32 } # check the message for bad words + my @bad; my @words; + @bad = BadWords::check($ref->{subject}); + push @words, [$ref->{subject}, @bad] if @bad; for (@{$ref->{lines}}) { - push @words, BadWords::check($_); + @bad = BadWords::check($_); + push @words, [$_, @bad] if @bad; } - push @words, BadWords::check($ref->{subject}); if (@words) { - dbg("$ref->{from} swore: '@words' -> $ref->{to} '$ref->{subject}' origin: $ref->{origin} via " . $dxchan->call) if isdbg('msg'); - Log('msg',"$ref->{from} swore: '@words' -> $ref->{to} origin: $ref->{origin} via " . $dxchan->call); + dbg("$ref->{from} swore: $ref->{to} '$ref->{subject}' origin: $ref->{origin} via " . $dxchan->call) if isdbg('msg'); + Log('msg',"$ref->{from} swore: $ref->{to} origin: $ref->{origin} via " . $dxchan->call); + dbg("subject: $ref->{subject}"); Log('msg',"subject: $ref->{subject}"); - for (@{$ref->{lines}}) { - Log('msg', "line: $_"); + for (@words) { + dbg("line: $_->[0] (using words: ". join(',',@{$_->[1]}).")"); + Log('msg', "line: $_->[0] (using words: ". join(',',@{$_->[1]}).")"); } $ref->stop_msg($fromnode); return; -- 2.43.0