if (&IsParam("useStrict")) { use strict; }
-use vars qw(@W3Search_engines $W3Search_regex);
-@W3Search_engines = qw(AltaVista Dejanews Excite Gopher HotBot Infoseek
- Lycos Magellan PLweb SFgate Simple Verity Google);
-$W3Search_regex = join '|', @W3Search_engines;
$babel::lang_regex = ""; # lame fix.
### PROPOSED COMMAND HOOK IMPLEMENTATION.
# RUN IF ADDRESSED.
sub parseCmdHook {
- my @args = split(' ', $message);
+ my @args = split(' ', $message);
+ my $cmd = shift(@args);
&shmFlush();
foreach (keys %cmdhooks) {
my $ident = $_;
- next unless ($args[0] =~ /^$ident$/i);
- shift(@args); # just gotta do it.
+ next unless ($cmd =~ /^$ident$/i);
- &DEBUG("pCH: found $ident");
+ &DEBUG("pCH: $cmd matched $ident");
my %hash = %{ $cmdhooks{$ident} };
### DEBUG.
foreach (keys %hash) {
- &DEBUG(" $ident->$_ => '$hash{$_}'.");
+ &DEBUG(" $cmd->$_ => '$hash{$_}'.");
}
### HELP.
### TODO: check if CODEREF exists.
- &{$hash{'CODEREF'}}(@args);
+### ANY PROBLEMS WITH THIS? if so, add option to do either.
+### &{$hash{'CODEREF'}}(@args);
+ &{$hash{'CODEREF'}}(join ' ', @args);
}
### CMDSTATS.
&addCmdHook('uptime', ('CODEREF' => 'uptime', 'Identifier' => 'uptime',
'Cmdstats' => 'Uptime') );
&addCmdHook('nullski', ('CODEREF' => 'nullski', ) );
+&addCmdHook('crash', ('CODEREF' => 'crash' ) );
sub nullski { my ($arg) = @_; foreach (`$arg`) { &msg($who,$_); } }
-&addCmdHook('freshmeat', ('CODEREF' => 'Freshmeat::Freshmeat',
+&addCmdHook('(fm|freshmeat)', ('CODEREF' => 'Freshmeat::Freshmeat',
'Identifier' => 'freshmeat', 'Cmdstats' => 'Freshmeat',
- 'Module' => 'freshmeat', 'Help' => 'freshmeat') );
+ 'Forker' => 1, 'Help' => 'freshmeat') );
}
# google searching. Simon++
- if (&IsParam("wwwsearch") and $message =~ /^(?:search\s+)?($W3Search_regex)\s+for\s+['"]?(.*?)['"]?\s*\?*$/i) {
+ if (&IsParam("wwwsearch") and $message =~ /^(?:search\s+)?(\S+)\s+for\s+['"]?(.*?)['"]?\s*\?*$/i) {
return $noreply unless (&hasParam("wwwsearch"));
- &Forker("wwwsearch", sub { &W3Search::W3Search($1,$2,$param{'wwwsearch'}); } );
+ &Forker("wwwsearch", sub { &W3Search::W3Search($1,$2); } );
$cmdstats{'WWWSearch'}++;
return $noreply;
}
sub convert {
- my (@args) = @_;
- my ($from,$to);
- ($from,$to) = ($args[0],$args[2]) if ($args[1] =~ /^from$/i);
- ($from,$to) = ($args[2],$args[0]) if ($args[1] =~ /^to$/i);
+ my $arg = join(' ',@_);
+ my ($from,$to) = ('','');
- if (!defined $from or !defined $to or $to eq "" or $from eq "") {
+ ($from,$to) = ($1,$2) if ($arg =~ /^(.*?) to (.*)$/i);
+ ($from,$to) = ($2,$1) if ($arg =~ /^(.*?) from (.*)$/i);
+
+ if (!$to or !$from) {
&msg($who, "Invalid format!");
&help("convert");
return $noreply;