From 43093ee84302e30d33b8fa45c68e54e6d21e7353 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 27 Dec 2019 19:28:51 -0800 Subject: [PATCH] Services identification now customizable via registry --- PBot/IRCHandlers.pm | 17 ++++++++++++++++- data/registry | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/PBot/IRCHandlers.pm b/PBot/IRCHandlers.pm index 86ab8cb5..fd0120bb 100644 --- a/PBot/IRCHandlers.pm +++ b/PBot/IRCHandlers.pm @@ -93,11 +93,26 @@ sub on_connect { if (length $self->{pbot}->{registry}->get_value('irc', 'identify_password')) { $self->{pbot}->{logger}->log("Identifying with NickServ . . .\n"); - $event->{conn}->privmsg("nickserv", "identify " . $self->{pbot}->{registry}->get_value('irc', 'botnick') . ' ' . $self->{pbot}->{registry}->get_value('irc', 'identify_password')); + + my $nickserv = $self->{pbot}->{registry}->get_value('general', 'identify_nick') // 'nickserv'; + my $command = $self->{pbot}->{registry}->get_value('general', 'identify_command') // 'identify $nick $password'; + + my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick'); + my $password = $self->{pbot}->{registry}->get_value('irc', 'identify_password'); + + $command =~ s/\$nick\b/$botnick/g; + $command =~ s/\$password\b/$password/g; + + $event->{conn}->privmsg($nickserv, $command); + } else { + $self->{pbot}->{logger}->log("No identify password; skipping identification to services.\n"); } if (not $self->{pbot}->{registry}->get_value('general', 'autojoin_wait_for_nickserv')) { + $self->{pbot}->{logger}->log("Autojoining channels immediately; to wait for services set general.autojoin_wait_for_nickserv to 1.\n"); $self->{pbot}->{channels}->autojoin; + } else { + $self->{pbot}->{logger}->log("Waiting for services identify response before autojoining channels.\n"); } return 0; diff --git a/data/registry b/data/registry index 5de4e97f..e75ee274 100644 --- a/data/registry +++ b/data/registry @@ -178,6 +178,14 @@ "deop_timeout" : { "type" : "text", "value" : "300" + }, + "identify_nick" : { + "type" : "text", + "value" : "nickserv" + }, + "identify_command" : { + "type" : "text", + "value" : "identify $nick $pasword" }, "module_dir" : { "type" : "text",