]> git.donarmstrong.com Git - infobot.git/commitdiff
preliminary command hook support added
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 30 Aug 2000 12:19:23 +0000 (12:19 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 30 Aug 2000 12:19:23 +0000 (12:19 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@56 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl

index 60b8ec237d97020cbfac23c32259c0f60a262557..1775c083bfafac53685a828b6da47c7761e63ad4 100644 (file)
@@ -17,7 +17,8 @@ $W3Search_regex = join '|', @W3Search_engines;
 #      Cmdstats        => 'text_label',)
 #}
 ### EXAMPLE
-# addCmdHook('d?find', \&debianFind(), (
+# addCmdHook('d?find', (
+#      CODEREF => \&debianFind(),
 #      Forker => 1,
 #      Identifier => "debian",
 #      Help => "dfind",
@@ -26,6 +27,26 @@ $W3Search_regex = join '|', @W3Search_engines;
 #   * viable solution?
 ###
 
+sub addCmdHook {
+    my ($ident, %hash) = @_;
+
+    &DEBUG("aCH: added $ident to command hooks.");
+    $cmdhooks{$ident} = \%hash;
+}
+
+# RUN IF ADDRESSED.
+sub parseCmdHook {
+    foreach (keys %cmdhooks) {
+       &DEBUG("cmdhooks{$_} => ...");
+       my %hash = \%{ $cmdhooks{$_} };
+       foreach (keys %hash) {
+           &DEBUG("   '$_' => '$hash{$_}'.");
+       }
+    }
+
+    &DEBUG("pCH: ended.");
+}
+
 sub Modules {
     if (!defined $message) {
        &WARN("Modules: message is undefined. should never happen.");