]> git.donarmstrong.com Git - infobot.git/blobdiff - src/CommandStubs.pl
HTTPDtype from #php
[infobot.git] / src / CommandStubs.pl
index 4f0e121d49c50bd37673bcf5ff67ba89d283974e..bdcaf0b107ed940672bbf059d0aac74331d4cfd6 100644 (file)
@@ -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) {
@@ -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); } );