mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-05 19:49:32 +01:00
NickList: handle nickchange before any other handlers
This commit is contained in:
parent
21d06bc149
commit
1eaf85239f
@ -224,7 +224,7 @@ sub check_flood {
|
||||
|
||||
my $channels;
|
||||
if ($mode == MSG_NICKCHANGE) {
|
||||
$channels = $self->{pbot}->{nicklist}->get_channels($oldnick);
|
||||
$channels = $self->{pbot}->{nicklist}->get_channels($nick);
|
||||
} else {
|
||||
$self->update_join_watch($account, $channel, $text, $mode);
|
||||
push @$channels, $channel;
|
||||
|
@ -24,13 +24,13 @@ sub initialize {
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.public', sub { $self->on_activity(@_) }, 0);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.caction', sub { $self->on_activity(@_) }, 0);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.modeflag', sub { $self->on_modeflag(@_) }, 0);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.nick', sub { $self->on_nickchange(@_) }, 0);
|
||||
|
||||
# lowest priority so these get handled by NickList after all other handlers
|
||||
# (all other handlers should be given a priority < 100)
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.part', sub { $self->on_part(@_) }, 100);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.quit', sub { $self->on_quit(@_) }, 100);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.kick', sub { $self->on_kick(@_) }, 100);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.nick', sub { $self->on_nickchange(@_) }, 100);
|
||||
|
||||
# handlers for the bot itself joining/leaving channels (highest priority)
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('pbot.join', sub { $self->on_self_join(@_) }, 0);
|
||||
|
@ -32,7 +32,8 @@ sub initialize {
|
||||
sub on_sasl_authenticate {
|
||||
my ($self, $event_type, $event) = @_;
|
||||
|
||||
my $nick = $self->{pbot}->{registry}->get_value('irc', 'botnick');
|
||||
my $nick = $self->{pbot}->{registry}->get_value('irc', 'identify_nick'); # try identify_nick
|
||||
$nick //= $self->{pbot}->{registry}->get_value('irc', 'botnick'); # fallback to botnick
|
||||
my $password = $self->{pbot}->{registry}->get_value('irc', 'identify_password');
|
||||
|
||||
if (not defined $password or not length $password) {
|
||||
|
@ -146,7 +146,7 @@ sub on_nickchange {
|
||||
|
||||
my $message_account = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
||||
$self->{pbot}->{messagehistory}->{database}->devalidate_all_channels($message_account, $self->{pbot}->{antiflood}->{NEEDS_CHECKBAN});
|
||||
my $channels = $self->{pbot}->{nicklist}->get_channels($nick);
|
||||
my $channels = $self->{pbot}->{nicklist}->get_channels($newnick);
|
||||
foreach my $channel (@$channels) {
|
||||
next if $channel !~ m/^#/;
|
||||
$self->{pbot}->{messagehistory}->add_message($message_account, "$nick!$user\@$host", $channel, "NICKCHANGE $newnick", MSG_NICKCHANGE);
|
||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4619,
|
||||
BUILD_REVISION => 4620,
|
||||
BUILD_DATE => "2023-02-13",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user