Parse PART and added event on_part.
This commit is contained in:
1 parent
fd87d75692
commit
d3bb112d03
2 files changed
+30
No files matched your search
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
==================================================================
|
||||
* Added event on_part.
|
||||
* Parse PART.
|
||||
* Update chanusers on JOIN.
|
||||
* Properly parse NICK and update chanusers.
|
||||
* Added --enable-ssl to ./install for the future SSL support.
|
||||
|
||||
@@ -26,6 +26,7 @@ our %RAWC = (
|
||||
'JOIN' => \&cjoin,
|
||||
'NICK' => \&nick,
|
||||
'NOTICE' => \¬ice,
|
||||
'PART' => \&part,
|
||||
'PRIVMSG' => \&privmsg,
|
||||
'TOPIC' => \&topic,
|
||||
);
|
||||
@@ -38,6 +39,7 @@ API::Std::event_add("on_rcjoin");
|
||||
API::Std::event_add("on_ucjoin");
|
||||
API::Std::event_add("on_nick");
|
||||
API::Std::event_add("on_notice");
|
||||
API::Std::event_add("on_nick");
|
||||
API::Std::event_add("on_cprivmsg");
|
||||
API::Std::event_add("on_uprivmsg");
|
||||
API::Std::event_add("on_topic");
|
||||
@@ -366,6 +368,32 @@ sub notice
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Parse: PART
|
||||
sub part
|
||||
{
|
||||
my ($svr, @ex) = @_;
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
|
||||
# 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", ($svr, %src, $ex[2], $msg));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Parse: PRIVMSG
|
||||
sub privmsg
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user