diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 6fd9375..df52bb1 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Changed on_topic args to: full source hashref, new topic array + * on_topic is now triggered for any topic change, regardless of source. * Now parsing numeric 004. * Added hook on_isupport. * Added a BotStats module for returning statistics about the bot. diff --git a/lib/Proto/IRC.pm b/lib/Proto/IRC.pm index 1a9adf7..fc4a476 100644 --- a/lib/Proto/IRC.pm +++ b/lib/Proto/IRC.pm @@ -681,19 +681,12 @@ sub quit { sub topic { my ($svr, @ex) = @_; my %src = API::IRC::usrc(substr($ex[0], 1)); + $src{svr} = $svr; + $src{chan} = $ex[2]; + $ex[3] = substr $ex[3], 1; - # Ignore it if it's coming from us. - if (lc($src{nick}) ne lc($botinfo{$svr}{nick})) { - $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", ($svr, \%src, @argv)); - } + # Trigger on_topic. + API::Std::event_run('on_topic', (\%src, @ex[3..$#ex])); return 1; }