From 344500bcd723372c0cbf0fffceec774b950818c2 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sat, 29 Jan 2011 17:14:47 -0700 Subject: [PATCH] Added hooks on_uprivmsg and on_cprivmsg. --- doc/CHANGELOG | 1 + src/Parser/IRC.pm | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 2d64177..9cac44f 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev ================================================================== + * Added hooks on_uprivmsg and on_cprivmsg. * Module names are now case sensitive. * Added config option module for auto-loading a module. * Fixed a bug in API::Log that caused invalid months. diff --git a/src/Parser/IRC.pm b/src/Parser/IRC.pm index ebd26ce..3393f08 100644 --- a/src/Parser/IRC.pm +++ b/src/Parser/IRC.pm @@ -26,6 +26,7 @@ our %RAWC = ( 'JOIN' => \&cjoin, 'NICK' => \&nick, 'PRIVMSG' => \&privmsg, + 'TOPIC' => \&topic, ); # Variables for various functions. @@ -35,6 +36,8 @@ our (%got_001, %botnick, %botchans, %csprefix, %chanusers); API::Std::event_add("on_rcjoin"); API::Std::event_add("on_ucjoin"); API::Std::event_add("on_nick"); +API::Std::event_add("on_cprivmsg"); +API::Std::event_add("on_uprivmsg"); API::Std::event_add("on_topic"); # Parse raw data. @@ -358,6 +361,9 @@ sub privmsg &{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix; } } + + # Trigger event on_uprivmsg. + API::Std::event_run("on_uprivmsg", ($svr, @ex)); } else { # It is coming to us in a channel message. @@ -370,6 +376,9 @@ sub privmsg &{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix; } } + + # Trigger event on_cprivmsg. + API::Std::event_run("on_cprivmsg", ($svr, @ex)); } return 1;