From: minima Date: Sat, 7 Jan 2006 16:53:03 +0000 (+0000) Subject: fix swearing logging so that it is better. X-Git-Tag: R_1_52~46 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=363580155c0ea3605530752cb98aca43f2736938;p=spider.git 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). --- 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 7ab6cce2..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; @@ -104,20 +122,28 @@ return (1, @out) unless $valid; # Store it here (but only if it isn't baddx) 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); -my $thing = Thingy::Dx->new(user=>$spotter); -$thing->from_DXProt(spotdata=>\@spot); -if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) { +if ($freq =~ /^69/ || $localonly) { # heaven forfend that we get a 69Mhz band :-) if ($freq =~ /^69/) { $self->badcount(($self->badcount||0) + 1); } + + $self->dx_spot(undef, undef, @spot); + return (1); } else { - $thing->queue($self); + if (@spot) { + # store it + Spot::add(@spot); + + # send orf to the users + DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot); + } } -push @out, $thing->gen_DXCommandmode($self); + return (1, @out); 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 2a2e9078..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; @@ -39,7 +39,10 @@ use Carp; use strict; use vars qw($VERSION $BRANCH); -main::mkver($VERSION = q$Revision$) if main->can('mkver'); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); +$main::build += $VERSION; +$main::branch += $BRANCH; use vars qw($log); @@ -201,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 5190b6b6..f4a1b7ab 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -33,8 +33,10 @@ eval { use strict; use vars qw($VERSION $BRANCH); - -main::mkver($VERSION = q$Revision$); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); +$main::build += $VERSION; +$main::branch += $BRANCH; use vars qw(%work @msg $msgdir %valid %busy $maxage $last_clean $residencetime @badmsg @swop $swopfn $badmsgfn $forwardfn @forward $timeout $waittime @@ -344,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;