3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

IRC: wait for NickServ NOTICE before identifying

This commit is contained in:
Pragmatic Software 2011-02-12 05:30:44 +00:00
parent 9c17b4bc5a
commit b07306f530
3 changed files with 10 additions and 6 deletions

View File

@ -61,7 +61,7 @@ sub get_flood_account {
foreach my $mask (keys %{ $self->message_history }) {
# check if foo!bar@baz matches foo!*@*; e.g., same nick, but possibly different user@host
# (usually logging into nickserv, but could possibly be attempted nick hijacking)
# (usually logging into nickserv or a dynamic ip address, but could possibly be attempted nick hijacking)
if($mask =~ m/^\Q$nick\E!.*/i) {
$self->{pbot}->logger->log("anti-flood: [get-account] $nick!$user\@$host seen previously as $mask\n");

View File

@ -40,8 +40,7 @@ sub initialize {
sub on_connect {
my ($self, $conn) = @_;
$self->{pbot}->logger->log("Connected! Identifying with NickServ . . .\n");
$conn->privmsg("nickserv", "identify " . $self->pbot->identify_password);
$self->{pbot}->logger->log("Connected!\n");
$conn->{connected} = 1;
}
@ -92,7 +91,12 @@ sub on_notice {
$self->{pbot}->logger->log("Received NOTICE from $nick $host '$text'\n");
if($nick eq "NickServ" && $text =~ m/You are now identified/i) {
if($nick eq "NickServ" && $text =~ m/This nickname is registered/) {
$self->{pbot}->logger->log("Identifying with NickServ . . .\n");
$conn->privmsg("nickserv", "identify " . $self->pbot->identify_password);
}
if($nick eq "NickServ" && $text =~ m/You are now identified/) {
foreach my $chan (keys %{ $self->{pbot}->channels->channels->hash }) {
if($self->{pbot}->channels->channels->hash->{$chan}{enabled}) {
$self->{pbot}->logger->log("Joining channel: $chan\n");

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 309,
BUILD_DATE => "2011-02-10",
BUILD_REVISION => 310,
BUILD_DATE => "2011-02-11",
};
1;