3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Remove captcha from unbanme command

This commit is contained in:
Pragmatic Software 2010-06-18 11:12:55 +00:00
parent fe96faded8
commit 41bb89eba2
2 changed files with 5 additions and 25 deletions

View File

@ -179,10 +179,7 @@ sub check_flood {
$timeout = "several" if($timeout > 8);
my $captcha = generate_random_string(7);
${ $self->message_history }{$account}{$channel}{captcha} = $captcha;
$self->{pbot}->conn->privmsg($nick, "You have been banned from $channel for $timeout hours due to join flooding. If your connection issues have been fixed, or this was an accident, you may request an unban by responding to this message with: unbanme $channel $captcha");
$self->{pbot}->conn->privmsg($nick, "You have been banned from $channel for $timeout hours due to join flooding. If your connection issues have been fixed, or this was an accident, you may request an unban at any time by responding to this message with: unbanme $channel; however, abusing this may lead to a permanent ban.");
${ $self->message_history }{$account}{$channel}{join_watch} = $max_messages - 2; # give them a chance to rejoin
}
@ -249,11 +246,10 @@ sub prune_message_history {
sub unbanme {
my ($self, $from, $nick, $user, $host, $arguments) = @_;
my $channel = $arguments;
my ($channel, $captcha) = split / /, $arguments;
if(not defined $channel or not defined $captcha) {
return "/msg $nick Usage: unbanme <channel> <captcha>";
if(not defined $channel) {
return "/msg $nick Usage: unbanme <channel>";
}
my $banmask = address_to_mask($host);
@ -268,25 +264,9 @@ sub unbanme {
return "/msg $nick There is no temporary ban set for $mask in channel $channel.";
}
my $account = $self->get_flood_account($nick, $user, $host);
if(not defined $account) {
return "/msg $nick I do not remember you.";
}
if(not exists $self->{message_history}->{$account}{$channel}{captcha}) {
return "/msg $nick I do not remember banning you in $channel.";
}
if(not $self->{message_history}->{$account}{$channel}{captcha} eq $captcha) {
return "/msg $nick Incorrect captcha.";
}
# TODO: these delete statements need to be abstracted to methods on objects
$self->{pbot}->chanops->unban_user($mask, $channel);
delete $self->{pbot}->chanops->{unban_timeout}->hash->{$mask};
$self->{pbot}->chanops->{unban_timeout}->save_hash();
delete $self->{message_history}->{$account}{$channel}{captcha};
return "/msg $nick You have been unbanned from $channel.";
}

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 176,
BUILD_REVISION => 177,
BUILD_DATE => "2010-06-18",
};