From 3df0eced7bf9366e5827374de97ad09a71da1b28 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Wed, 9 Feb 2011 14:43:48 -0700 Subject: [PATCH] Moved CTCP VERSION reply. --- bin/auto | 3 +-- src/Core/Cmd.pm | 18 ------------------ src/Core/IRC.pm | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/bin/auto b/bin/auto index ecd81e9..b6fcbef 100755 --- a/bin/auto +++ b/bin/auto @@ -37,6 +37,7 @@ use DB::Flatfile; use Parser::Config; use Parser::Lang; use Parser::IRC; +use Core::IRC; use Core::Cmd; our $VERSION = 3.0.0; @@ -348,8 +349,6 @@ else { } undef $it; -# Create core hooks. -API::Std::hook_add('on_uprivmsg', 'ctcp_version_reply', \&Core::Cmd::version_reply); # Create core commands. API::Std::cmd_add('MODLOAD', 1, 'cfunc.modules', \%Core::Cmd::HELP_MODLOAD, \&Core::Cmd::cmd_modload); API::Std::cmd_add('MODUNLOAD', 1, 'cfunc.modules', \%Core::Cmd::HELP_MODUNLOAD, \&Core::Cmd::cmd_modunload); diff --git a/src/Core/Cmd.pm b/src/Core/Cmd.pm index 3b7458a..cc6626a 100644 --- a/src/Core/Cmd.pm +++ b/src/Core/Cmd.pm @@ -11,24 +11,6 @@ use API::Std qw(trans has_priv match_user); use API::Log qw(dbug alog); use API::IRC qw(notice quit usrc); -sub version_reply -{ - my (($svr, @ex)) = @_; - my %src = usrc(substr($ex[0], 1)); - - if ($ex[3] eq ":\001VERSION\001") { - if (Auto::RSTAGE ne 'd') { - notice($svr, $src{nick}, "VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE." ".$OSNAME); - } - else { - notice($svr, $src{nick}, "VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE."-".Auto::GR." ".$OSNAME); - } - } - - return 1; -} - - # Help hash for MODLOAD. Spanish, French and German needed. our %HELP_MODLOAD = ( 'en' => 'Loads a module into the running Auto live.', diff --git a/src/Core/IRC.pm b/src/Core/IRC.pm index 5f44c15..d233d1e 100644 --- a/src/Core/IRC.pm +++ b/src/Core/IRC.pm @@ -8,3 +8,21 @@ use strict; use warnings; use API::Std qw(hook_add hook_del); our $VERSION = 3.000000; + +# CTCP VERSION reply. +sub version_reply +{ + my (($svr, @ex)) = @_; + my %src = usrc(substr($ex[0], 1)); + + if ($ex[3] eq ":\001VERSION\001") { + if (Auto::RSTAGE ne 'd') { + notice($svr, $src{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE." ".$OSNAME."\001"); + } + else { + notice($svr, $src{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE."-".Auto::GR." ".$OSNAME."\001"); + } + } + + return 1; +}