### COMMAND HOOK IMPLEMENTATION.
# addCmdHook("SECTION", 'TEXT_HOOK',
-# (CODEREF => 'Blah',
+# (CODEREF => 'Blah',
# Forker => 1,
# CheckModule => 1, # ???
# Module => 'blah.pl' # preload module.
# 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 || '');
next;
}
- &status("hooks($hashname): $cmd matched '$ident'");
+ &status("hooks($hashname): $cmd matched '$ident' '$flatarg'");
my %hash = %{ ${"hooks_$hashname"}{$ident} };
if (!scalar keys %hash) {
&addCmdHook("extra", 'd?find', ('CODEREF' => 'Debian::DebianFind',
'Forker' => 1, 'Identifier' => 'debian',
'Cmdstats' => 'Debian Search', 'Help' => "find" ) );
-&addCmdHook("extra", 'insult', ('CODEREF' => 'Insult::Insult',
- 'Forker' => 1, 'Identifier' => 'insult', 'Help' => "insult" ) );
+#&addCmdHook("extra", 'insult', ('CODEREF' => 'Insult::Insult',
+# 'Forker' => 1, 'Identifier' => 'insult', 'Help' => "insult" ) );
&addCmdHook("extra", 'kernel', ('CODEREF' => 'Kernel::Kernel',
'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',
'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.
return;
}
- my $debiancmd = 'conflicts?|depends?|desc|file|info|provides?';
+ my $debiancmd = 'conflicts?|depends?|desc|file|(?:d)?info|provides?';
$debiancmd .= '|recommends?|suggests?|maint|maintainer';
if ($message =~ /^($debiancmd)(\s+(.*))?$/i) {
}
# 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); } );
my $itc;
$itc = &getChanConf("ircTextCounters");
$itc = &findChanConf("ircTextCounters") unless ($itc);
- if ($itc) {
- &do_text_counters($itc);
- return;
- }
+ return if ($itc && &do_text_counters($itc) == 1);
+ # end of text counters.
# list{keys|values}. xk++. Idea taken from #linuxwarez@EFNET
if ($message =~ /^list(\S+)(\s+(.*))?$/i) {
$reply .= " (".&Time2String(time() - $userstats{lc $seen[0]}{'Join'}).")";
}
- if (&IsParam("seenStats")) {
+ if (&IsChanConf("seenStats") > 0) {
my $i;
$i = $userstats{lc $seen[0]}{'Count'};
$reply .= ". Has said a total of \002$i\002 messages" if (defined $i);
if ($message =~ /^_stats(\s+(\S+))$/i) {
&textstats_main($2);
- return;
+ return 1;
}
my ($type,$arg);
$type = $1;
$arg = $3;
} else {
- return;
+ return 0;
}
# even more uglier with channel/time arguments.
if (!defined $x) { # !defined.
&pSReply("$arg has not said $type yet.");
- return;
+ return 1;
}
# defined.
&pSReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
}
- if ($@) {
- &DEBUG("regex failed: $@");
- return;
- }
+ return 1;
}
sub textstats_main {