diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 95fba34..409ac3e 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev ================================================================== + * Parse Numeric:432. * Parse Numeric:433. * Added nick() to API::IRC. * Added %got_001 to Parser::IRC for checking if we've been diff --git a/src/API/IRC.pm b/src/API/IRC.pm index e12f158..85c4773 100644 --- a/src/API/IRC.pm +++ b/src/API/IRC.pm @@ -88,5 +88,6 @@ sub quit } delete $Parser::IRC::got_001{$svr} if (defined $Parser::IRC::got_001{$svr}); + delete $Parser::IRC::botnick{$svr} if (defined $Parser::IRC::botnick{$svr}); } diff --git a/src/Parser/IRC.pm b/src/Parser/IRC.pm index 39b9849..fa59bbc 100644 --- a/src/Parser/IRC.pm +++ b/src/Parser/IRC.pm @@ -7,11 +7,12 @@ package Parser::IRC; use strict; use warnings; use API::Std qw(conf_get); -use API::IRC qw(cjoin nick); +use API::IRC qw(cjoin nick quit); # Raw parsing hash. our %RAWC = ( '001' => \&num001, + '432' => \&num432, '433' => \&num433, ); @@ -70,6 +71,21 @@ sub num001 } } +# Parse: Numeric:432 +# Erroneous nickname. +sub num432 +{ + my ($svr, undef) = @_; + + if ($got_001{$svr}) { + err(3, "Got error from server[".$svr."]: Erroneous nickname.", 0); + } + else { + err(2, "Got error from server[".$svr."] before 001: Erroneous nickname. Closing connection.", 0); + quit($svr, "An error occurred."); + } +} + # Parse: Numeric:433 # Nickname is already in use. sub num433