From 411e08fd1c9debc5d587a98ca0d89bfb01e9f39d Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Fri, 18 Feb 2011 23:49:27 -0700 Subject: [PATCH] Added core command MODLIST. --- NEWS | 1 + bin/auto | 1 + doc/CHANGELOG | 1 + lib/Core/Cmd.pm | 24 +++++++++++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ef85856..b472a4a 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ the popular Auto IRC bot. In this alpha5 release, we have added: * LinkTitle module for returning the page title of links sent to a channel. +* Added core command MODLIST. Bug fixes: diff --git a/bin/auto b/bin/auto index f4580dc..4be6a0f 100755 --- a/bin/auto +++ b/bin/auto @@ -434,6 +434,7 @@ undef $it; 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); API::Std::cmd_add('MODRELOAD', 1, 'cfunc.modules', \%Core::Cmd::HELP_MODRELOAD, \&Core::Cmd::cmd_modreload); +API::Std::cmd_add('MODLIST', 1, 'cfunc.modules', \%Core::Cmd::HELP_MODLIST, \&Core::Cmd::cmd_modlist); API::Std::cmd_add('SHUTDOWN', 2, 'cmd.shutdown', \%Core::Cmd::HELP_SHUTDOWN, \&Core::Cmd::cmd_shutdown); API::Std::cmd_add('RESTART', 2, 'cmd.restart', \%Core::Cmd::HELP_RESTART, \&Core::Cmd::cmd_restart); API::Std::cmd_add('REHASH', 2, 'cmd.rehash', \%Core::Cmd::HELP_REHASH, \&Core::Cmd::cmd_rehash); diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 984d082..44b48b8 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Added core command MODLIST. * Added command level 3 for logchan-only command. * Added a LinkTitle module for getting the title of a web page posted in a channel. diff --git a/lib/Core/Cmd.pm b/lib/Core/Cmd.pm index 85b8341..3a16eb6 100644 --- a/lib/Core/Cmd.pm +++ b/lib/Core/Cmd.pm @@ -125,9 +125,31 @@ sub cmd_modreload return 1; } +# Help hash for MODLIST. Spanish, French and German needed. +our %HELP_MODLIST = ( + 'en' => "This will return a list of all currently loaded modules. \2Syntax:\2 MODLIST", +); +# MODLIST callback. +sub cmd_modlist +{ + my ($src, undef) = @_; + + # Iterate through all loaded modules. + my $str; + foreach (keys %API::Std::MODULE) { + $str .= ", \2$_\2 (v".$API::Std::MODULE{$_}{version}.')'; + } + + # Return it. + $str = substr $str, 2; + notice($src->{svr}, $src->{nick}, "\2Module List:\2 $str"); + + return 1; +} + # Help hash for SHUTDOWN. Spanish, French and German needed. our %HELP_SHUTDOWN = ( - 'en' => 'This will send out shutdown notifications, quit all networks, flush the database then exit the program.', + 'en' => "This will send out shutdown notifications, quit all networks, flush the database then exit the program. \2Syntax:\2 SHUTDOWN", ); # SHUTDOWN callback. sub cmd_shutdown