Rewrote how we parse what channels the bot is in.

This commit is contained in:
Elijah Perrault committed 2011-01-21 16:39:10 -07:00
1 parent 1e178687bc
commit 3afdcfd374
2 files changed
+21 -7

No files matched your search

-7
View File
@@ -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.
+21
View File
@@ -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;