6. Add badword handling for messages. Users will get rude messages back if
they try to send naughty words in msgs. Incoming messages with badwords will
be dropped on receipt and their contents logged.
+7. and if you swear 3 or more times you are unceremoniously logged out.
30Sep01=======================================================================
1. made some small bug fixes in rspf checking and also messages.
23Sep01=======================================================================
my @bad;
if (@bad = BadWords::check($line)) {
+ $self->badcount(($self->badcount||0) + @bad);
return (1, $self->msg('e17', @bad));
}
return (1, @out) unless $valid;
my @bad;
-if (@bad = BadWords::check($line)) {
+if (@bad = BadWords::check($line)) {
+ $self->badcount(($self->badcount||0) + @bad);
return (1, $self->msg('e17', @bad));
}
if ($line) {
my @bad;
if (@bad = BadWords::check($line)) {
+ $self->badcount(($self->badcount||0) + @bad);
return (1, $self->msg('e17', @bad));
}
$dxchan->talk($self->call, $to, $via, $line) if $dxchan;
disconnecting => '9,Disconnecting,yesno',
ann_talk => '0,Suppress Talk Anns,yesno',
metric => '1,Route metric',
+ badcount => '1,Bad Word Count',
+ edit => '7,Edit Function',
);
use vars qw($VERSION $BRANCH);
use strict;
-use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug);
+use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount);
%Cache = (); # cache of dynamically loaded routine's mod times
%cmd_cache = (); # cache of short names
%aliases = (); # aliases for (parts of) commands
$scriptbase = "$main::root/scripts"; # the place where all users start scripts go
$maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
+$maxbadcount = 3; # no of bad words allowed before disconnection
+
use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
} else {
$self->send_ans(run_cmd($self, $cmdline));
}
-
+
+ # check for excessive swearing
+ if ($self->{badcount} && $self->{badcount} >= $maxbadcount) {
+ Log('DXCommand', "$self->{call} logged out for excessive swearing");
+ $self->disconnect;
+ return;
+ }
+
# send a prompt only if we are in a prompt state
$self->prompt() if $self->{state} =~ /^prompt/o;
}
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'));
}
$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));