]> git.donarmstrong.com Git - infobot.git/blobdiff - src/CommandStubs.pl
ws
[infobot.git] / src / CommandStubs.pl
index 4f0e121d49c50bd37673bcf5ff67ba89d283974e..7da444ec790176150a434ec4afa892d43285a9a2 100644 (file)
@@ -18,7 +18,7 @@ $w3search_regex   = "google";
 
 ### COMMAND HOOK IMPLEMENTATION.
 # addCmdHook("SECTION", 'TEXT_HOOK',
-#      (CODEREF        => 'Blah', 
+#      (CODEREF        => 'Blah',
 #      Forker          => 1,
 #      CheckModule     => 1,                   # ???
 #      Module          => 'blah.pl'            # preload module.
@@ -44,7 +44,8 @@ sub addCmdHook {
 # RUN IF ADDRESSED.
 sub parseCmdHook {
     my ($hashname, $line) = @_;
-    $line =~ /^(\S+)( (.*))?$/;
+    $line =~ s/^\s+|\s+$//g;   # again.
+    $line =~ /^(\S+)(\s+(.*))?$/;
     my $cmd    = $1;   # command name is whitespaceless.
     my $flatarg        = $3;
     my @args   = split(/\s+/, $flatarg || '');
@@ -73,7 +74,7 @@ sub parseCmdHook {
            next;
        }
 
-       &status("hooks($hashname): $cmd matched '$ident'");
+       &status("hooks($hashname): $cmd matched '$ident' '$flatarg'");
        my %hash = %{ ${"hooks_$hashname"}{$ident} };
 
        if (!scalar keys %hash) {
@@ -189,7 +190,7 @@ sub parseCmdHook {
        'Forker' => 1, 'Identifier' => 'kernel',
        'Cmdstats' => 'Kernel', 'NoArgs' => 1) );
 &addCmdHook("extra", 'listauth', ('CODEREF' => 'CmdListAuth',
-       'Identifier' => 'search', Module => 'factoids', 
+       'Identifier' => 'search', Module => 'factoids',
        'Help' => 'listauth') );
 &addCmdHook("extra", 'quote', ('CODEREF' => 'Quote::Quote',
        'Forker' => 1, 'Identifier' => 'quote',
@@ -247,6 +248,9 @@ sub parseCmdHook {
        'Forker' => 1) );
 &addCmdHook("extra", '(botmail|message)', ('CODEREF' => 'botmail::parse',
        'Identifier' => 'botmail', 'Cmdstats' => 'botmail') );
+&addCmdHook("extra", 'httpdtype', ('CODEREF' => 'HTTPDtype::HTTPDtype',
+       'Identifier' => 'httpdtype', 'Cmdstats' => 'httpdtype',
+       'Forker' => 1) );
 
 ###
 ### END OF ADDING HOOKS.
@@ -278,7 +282,7 @@ sub Modules {
        return;
     }
 
-    my $debiancmd       = 'conflicts?|depends?|desc|file|d?info|provides?';
+    my $debiancmd       = 'conflicts?|depends?|desc|file|(?:d)?info|provides?';
     $debiancmd         .= '|recommends?|suggests?|maint|maintainer';
 
     if ($message =~ /^($debiancmd)(\s+(.*))?$/i) {
@@ -295,7 +299,7 @@ sub Modules {
     }
 
     # google searching. Simon++
-    if ($message =~ /^(?:search\s+)?($w3search_regex)\s+for\s+['"]?(.*?)["']?\s*\?*$/i) {
+    if ($message =~ /^(?:search\s+)?($w3search_regex)\s+(?:for\s+)?['"]?(.*?)["']?\s*\?*$/i) {
        return unless (&hasParam("wwwsearch"));
 
        &Forker("wwwsearch", sub { &W3Search::W3Search($1,$2); } );