From f450caf6269edcbeb0d0b277d71aee17e7052939 Mon Sep 17 00:00:00 2001 From: Andreas Scherbaum Date: Mon, 13 Aug 2012 02:03:36 +0200 Subject: [PATCH] - handle nickserv passwords --- docbot.pl | 16 ++++++++++++++++ todo.txt | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docbot.pl b/docbot.pl index 3725188..64d1c01 100755 --- a/docbot.pl +++ b/docbot.pl @@ -874,6 +874,10 @@ BEGIN { print_msg("nickname is: $nick_name, desired nickname is: " . $main::sessions{$session}{'nickname'} . ", issuing nick change", INFO); $irc->yield( nick => $main::sessions{$session}{'nickname'} ); $main::sessions{$session}{'last_nick_change_attempt'} = time(); + my $password = config_get_key3('sessions', $session, 'password'); + if (defined($password) and length($password) > 0) { + $irc->yield( privmsg => 'nickserv', 'identify ' . $password ); + } } } } @@ -3790,6 +3794,18 @@ sub on_end_motd { print_msg("on_end_motd(session: $session)", DEBUG); + # auth the nickname + my $nickname = config_get_key3('sessions', $session, 'nickname'); + my $password = config_get_key3('sessions', $session, 'password'); + my $nickname_now = $irc->nick_name(); + if (lc($nickname_now) eq lc($nickname)) { + if (defined($password) and length($password) > 0) { + print_msg("authenticating against nickserv, session: $session", DEBUG); + $irc->yield( privmsg => 'nickserv', 'identify ' . $password ); + } + } + + $main::sessions{$session}{'past_motd'} = 1; } diff --git a/todo.txt b/todo.txt index 0e7fec9..510b34f 100644 --- a/todo.txt +++ b/todo.txt @@ -6,7 +6,6 @@ - extra channel - track each channel message and see, if the bot was mentioned - Log::Log4perl? -- nickserv handling (passwords) @@ -29,3 +28,4 @@ - predefine channels in the configuration which are not autojoined OK - allow a password for the ?join command OK - verify channel list from time to time, autojoin missing channels OK +- nickserv handling (passwords) OK -- 2.39.5