mirror of
git://scm.dxcluster.org/scm/spider
synced 2024-09-21 07:47:10 +00:00
add if you swear 3 or more times you are unceremoniously logged out
This commit is contained in:
parent
e0cfa6eebc
commit
c4f04ae165
1
Changes
1
Changes
@ -11,6 +11,7 @@ of commands again without coredumps. Hurrah!
|
||||
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=======================================================================
|
||||
|
@ -49,6 +49,7 @@ $line =~ s/\^/:/og;
|
||||
|
||||
my @bad;
|
||||
if (@bad = BadWords::check($line)) {
|
||||
$self->badcount(($self->badcount||0) + @bad);
|
||||
return (1, $self->msg('e17', @bad));
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,8 @@ if ($spotted le ' ') {
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ return (1, $self->msg('e7', $call)) unless $dxchan;
|
||||
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;
|
||||
|
@ -106,6 +106,8 @@ $count = 0;
|
||||
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);
|
||||
|
@ -34,7 +34,7 @@ use Script;
|
||||
|
||||
|
||||
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
|
||||
@ -42,6 +42,8 @@ $errstr = (); # error string from eval
|
||||
%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+)/ );
|
||||
@ -241,7 +243,14 @@ sub normal
|
||||
} 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;
|
||||
}
|
||||
|
@ -886,6 +886,7 @@ sub do_send_stuff
|
||||
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'));
|
||||
}
|
||||
@ -942,6 +943,7 @@ sub do_send_stuff
|
||||
$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));
|
||||
|
Loading…
Reference in New Issue
Block a user