X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXMsg.pm;h=dc9aff9197548ec2ca8c2650746c6a79e7404c1a;hb=f440e0d41cde05ede965cbf664bfcdbe6ed149f0;hp=45de0f9fa3d6a5682c52d0ee412e2805aa4df076;hpb=aaf98478dc930b9d337c85c41316a926046d7ae2;p=spider.git diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 45de0f9f..dc9aff91 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -69,10 +69,10 @@ $importfn = "$msgdir/import"; # import directory to => '0,To', from => '0,From', t => '0,Msg Time,cldatetime', - private => '5,Private', + private => '5,Private,yesno', subject => '0,Subject', linesreq => '0,Lines per Gob', - rrreq => '5,Read Confirm', + rrreq => '5,Read Confirm,yesno', origin => '0,Origin', lines => '5,Data', stream => '9,Stream No', @@ -298,6 +298,23 @@ sub process return; } + # check the message for bad words + my @words; + for (@{$ref->{lines}}) { + push @words, BadWords::check($_); + } + push @words, BadWords::check($ref->{subject}); + if (@words) { + dbg("message with badwords '@words' $ref->{from} -> $ref->{to} '$ref->{subject}' origin: $ref->{origin} via " . $self->call) if isdbg('msg'); + Log('msg',"message with badwords '@words' $ref->{from} -> $ref->{to} origin: $ref->{origin} via " . $self->call); + Log('msg',"subject: $ref->{subject}"); + for (@{$ref->{lines}}) { + Log('msg', "line: $_"); + } + $ref->stop_msg($self->call); + return; + } + $ref->{msgno} = next_transno("Msgno"); push @{$ref->{gotit}}, $f[2]; # mark this up as being received $ref->store($ref->{lines}); @@ -868,6 +885,11 @@ sub do_send_stuff # $DB::single = 1; confess "local var gone missing" if !ref $self->{loc}; my $loc = $self->{loc}; + if (my @ans = BadWords::check($line)) { + $self->{badcount} += @ans; + Log('msg', $self->call . " used badwords: @ans to @{$loc->{to}} in msg"); + return ($self->msg('e17', @ans), $self->msg('m1')); + } $loc->{subject} = $line; $loc->{lines} = []; $self->state('sendbody'); @@ -920,12 +942,18 @@ sub do_send_stuff $self->func(undef); $self->state('prompt'); } else { + if (my @ans = BadWords::check($line)) { + $self->{badcount} += @ans; + Log('msg', $self->call . " used badwords: @ans to @{$loc->{to}} subject: '$loc->{subject}' in msg"); + Log('msg', "line: $line"); + return ($self->msg('e17', @ans)); + } # i.e. it ain't and end or abort, therefore store the line push @{$loc->{lines}}, length($line) > 0 ? $line : " "; } } - return (1, @out); + return @out; } # return the standard directory line for this ref