s/\s+/ /g; # remove excessive whitespaces.
next unless (defined $level);
+ &DEBUG("strip control chars?");
s/[\cA-\c_]//ig # remove control characters.
}
# auth if 1) user and host match 2) user and nick match.
# this may change in the future.
- if ($this{'user'} =~ /^\Q$local{'user'}$/i) {
+ if ($this{'user'} =~ /^\Q$local{'user'}\E$/i) {
return 2 if ($this{'host'} eq $local{'host'});
return 1 if ($this{'nick'} eq $local{'nick'});
}
sub isStale {
my ($file, $age) = @_;
- &DEBUG("isStale: $file does not exist") unless ( -f $file);
return 1 unless ( -f $file);
- return 1 if (time() - (stat($file))[8] > $age*60*60*24);
- my $delta = time() - (stat($file))[8];
+ return 1 if (time() - (stat($file))[9] > $age*60*60*24);
+ my $delta = time() - (stat($file))[9];
my $hage = $age*60*60*24;
- &DEBUG("isStale: not stale! $delta < $hage");
return 0;
}
/\=\~/ and last; # substituition.
/^\S+ to \S+ \S+/ and last; # babelfish.
+ /^\=/ and last; # botnick = heh is.
+ /wants you to know/ and last;
+
# symbols.
/(\"\*)/ and last;
/, / and last;
/\\\%/ and last;
/\\\_/ and last;
- # weird/special stuff. also old (stock) blootbot bugs.
+ # weird/special stuff. also old blootbot or stock infobot bugs.
$rhs =~ /( \Q$ident\E's|\Q$ident\E's )/i and last; # ownership.
# duplication.
if (&IsParam("forking") and $$ == $bot_pid) {
return $noreply unless (&addForked($label));
$SIG{CHLD} = 'IGNORE';
- $pid = eval { fork() }; # catch non-forking OSes and other errors
- return $noreply if $pid; # parent does nothing
+ $pid = eval { fork() };
+ return $noreply if $pid; # parent does nothing
&status("fork starting for '$label', PID == $$.");
+ &shmWrite($shm,"SET FORKPID $label $$");
}
+ ### TODO: use AUTOLOAD
if (!&loadMyModule($myModules{$label})) {
&DEBUG("Forker: failed?");
return;
}
}
-sub checkPing {
- &DEBUG("checkPing() called.");
- $conn->schedule(60, \&checkPing, "this is a test");
- $conn->sl("PING $server :".time());
-}
-
sub closePID {
return 1 unless (exists $file{PID});
return 1 unless ( -f $file{PID});