Fixed a bug where incoming PART's from ourselves were not parsed.

This commit is contained in:
Elijah Perrault committed 2011-03-04 21:48:21 -07:00
1 parent 70723dfe68
commit 9b0e692a8f
4 files changed
+26 -16

No files matched your search

+1
View File
@@ -19,6 +19,7 @@ In this alpha7 release, we have added:
Bug fixes:
* Fixed a bug where a CAP entry for a network was not recreated on a reconnect.
* Fixed a bug where incoming PART's from ourselves were not parsed.
Incompatibilities:
+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
===============================================================================
* Fixed a bug where incoming PART's from ourselves were not parsed.
* Our usermodes are now tracked in Proto::IRC::umodes.
* Added events on_cmode and on_umode.
* Added event on_myinfo for RPL_MYINFO (numeric 004).
-2
View File
@@ -69,8 +69,6 @@ sub cpart
Auto::socksnd($svr, "PART $chan :Leaving");
}
if (defined $Proto::IRC::botchans{$svr}{$chan}) { delete $Proto::IRC::botchans{$svr}{$chan}; }
return 1;
}
+24 -14
View File
@@ -38,7 +38,7 @@ our %RAWC = (
);
# Variables for various functions.
our (%got_001, %botinfo, %botchans, %csprefix, %chanusers, %chanmodes, %cap);
our (%got_001, %botinfo, %botchans, %csprefix, %chanusers, %chanmodes, %cap, %umodes);
# Events.
API::Std::event_add('on_capack');
@@ -54,6 +54,7 @@ API::Std::event_add('on_namesreply');
API::Std::event_add('on_nick');
API::Std::event_add('on_notice');
API::Std::event_add('on_part');
API::Std::event_add('on_upart');
API::Std::event_add('on_cprivmsg');
API::Std::event_add('on_uprivmsg');
API::Std::event_add('on_quit');
@@ -597,23 +598,32 @@ sub part {
my %src = API::IRC::usrc(substr($ex[0], 1));
$src{svr} = $svr;
# Delete them from chanusers.
delete $chanusers{$svr}{$ex[2]}{$src{nick}} if defined $chanusers{$svr}{$ex[2]}{$src{nick}};
# Set $msg to the part message.
my $msg = 0;
if (defined $ex[3]) {
$msg = substr($ex[3], 1);
if (defined $ex[4]) {
for (my $i = 4; $i < scalar(@ex); $i++) {
$msg .= " ".$ex[$i];
# Check if it's from us or someone else.
if ($src{nick} eq $botinfo{$svr}{nick}) {
# Delete this channel from botchans.
if ($botchans{$svr}{$ex[2]}) { delete $botchans{$svr}{$ex[2]}; }
# Trigger on_upart.
API::Std::event_run('on_upart', ($svr, $ex[2]));
}
else {
# Delete them from chanusers.
delete $chanusers{$svr}{$ex[2]}{$src{nick}} if defined $chanusers{$svr}{$ex[2]}{$src{nick}};
# Set $msg to the part message.
my $msg = 0;
if (defined $ex[3]) {
$msg = substr($ex[3], 1);
if (defined $ex[4]) {
for (my $i = 4; $i < scalar(@ex); $i++) {
$msg .= " ".$ex[$i];
}
}
}
}
# Trigger on_part.
API::Std::event_run("on_part", (\%src, $ex[2], $msg));
# Trigger on_part.
API::Std::event_run("on_part", (\%src, $ex[2], $msg));
}
return 1;
}