Parse TOPIC.

This commit is contained in:
Elijah Perrault committed 2011-01-23 23:31:05 -07:00
1 parent ae6cfc4e99
commit 44908af99c
2 files changed
+23

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
==================================================================
* Parse TOPIC. (and added hook on_topic)
* Added DB::Flatfile for DB:: database functions.
* Added umode() to API::IRC.
* Added events on_ucjoin, on_rcjoin and on_nick.
+22
View File
@@ -32,6 +32,7 @@ our (%got_001, %botnick, %botchans);
API::Std::event_add("on_rcjoin");
API::Std::event_add("on_ucjoin");
API::Std::event_add("on_nick");
API::Std::event_add("on_topic");
# Parse raw data.
sub ircparse
@@ -230,6 +231,27 @@ sub nick
}
}
# Parse: TOPIC
sub topic
{
my ($svr, @ex) = @_;
my %src = API::IRC::usrc(substr($ex[0], 1));
# Ignore it if it's coming from us.
if (lc($src{nick}) ne lc($botnick{$svr})) {
$src{chan} = $ex[2];
my (@argv);
$argv[0] = substr($ex[3], 1);
if (defined $ex[4]) {
for (my $i = 4; $i < scalar(@ex); $i++) {
push(@argv, $ex[$i]);
}
}
API::Std::event_run("on_topic", (%src, @argv));
}
return 1;
}
1;