diff --git a/src/API/IRC.pm b/src/API/IRC.pm index 00f1200..c00260a 100644 --- a/src/API/IRC.pm +++ b/src/API/IRC.pm @@ -18,13 +18,6 @@ sub cjoin my ($svr, $chan) = @_; Auto::socksnd($svr, "JOIN $chan"); - - unless (defined $Parser::IRC::botchans{$svr}) { - @{ $Parser::IRC::botchans{$svr} } = ($chan); - } - else { - push(@{ $Parser::IRC::botchans{$svr} }, $chan); - } } # Part a channel. diff --git a/src/Parser/IRC.pm b/src/Parser/IRC.pm index a5dda90..779a0d6 100644 --- a/src/Parser/IRC.pm +++ b/src/Parser/IRC.pm @@ -14,6 +14,8 @@ our %RAWC = ( '001' => \&num001, '432' => \&num432, '433' => \&num433, + '438' => \&num438, + 'JOIN' => \&cjoin, 'NICK' => \&nick, ); @@ -121,6 +123,23 @@ sub num438 } } +# Parse: JOIN +sub cjoin +{ + my ($svr, @ex) = @_; + my %src = API::IRC::usrc(substr($ex[0], 1)); + + # Check if this is coming from ourselves. + if ($src{nick} eq $botnick{$svr}) { + unless (defined $botchans{$svr}) { + @{ $botchans{$svr} } = (substr($ex[2], 1)); + } + else { + push(@{ $botchans{$svr} }, substr($ex[2], 1)); + } + } +} + # Parse: NICK sub nick { @@ -135,4 +154,6 @@ sub nick } } + + 1;