]> dxcluster.org Git - spider.git/commitdiff
fix swearing logging so that it is better.
authorminima <minima>
Sat, 7 Jan 2006 16:53:03 +0000 (16:53 +0000)
committerminima <minima>
Sat, 7 Jan 2006 16:53:03 +0000 (16:53 +0000)
fix badspotters being able to send dx spots.
add LogDbg() routine to both log and dbg at the same time (at last).

Changes
cmd/announce.pl
cmd/chat.pl
cmd/dx.pl
cmd/talk.pl
perl/DXCommandmode.pm
perl/DXLog.pm
perl/DXMsg.pm

diff --git a/Changes b/Changes
index 7a72d80729fbf88c55d4487c5ddbaa38b0dc2a81..fdc6451020fecdb462964d6a9f010d0560f6b412 100644 (file)
--- 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 <call> sh/fdx
 27Dec05=======================================================================
index 5e0ff58c998c4c1c440d3a6a66ac66d0698ae4e8..9a1cbd376b2dcc13700351e14774867b939878e7 100644 (file)
@@ -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, ());
index cace4508250816edf5eae169ffcedd554e8dfe5d..41cbb5caba4b9cde16abe870507f83e6fc310460 100644 (file)
@@ -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");
 }
index 7ab6cce2e4d27ae2422cced80993092381f497d1..9454fd702d1f4b2843ef9aa4f931620f068e7142 100644 (file)
--- 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);
 
 
index 2815ad39c710896b82e72e0a04575b7b14686b7b..66d3cd2c72dd5d2152a5921784a4749aaeaaea70 100644 (file)
@@ -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;
        }
index 04a1b2866e850daf066562cc469456f2f5a7fc4d..29840c410e4c788359f97cbe26780dce0ce0519d 100644 (file)
@@ -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;
        }
index 2a2e9078d7f9cf2a1883aee172f4b45c421b02ae..785483533c562f50dfc438e30ecfebfda9cf024b 100644 (file)
@@ -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();
index 5190b6b6cc49dd3ac5e9b1e66eeb2efa85e04616..f4a1b7aba0e66dd6818d288e1e229b90d03a30b3 100644 (file)
@@ -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;