]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Misc.pl
Remove &ERROR() since it's done by WARN.
[infobot.git] / src / Misc.pl
index bbfe483e985c5610191b1eef28be9f1be645f19c..a593c3fbdaf9fe8eacff4cd1c89e5e40c4e9a7f2 100644 (file)
@@ -223,6 +223,7 @@ sub fixString {
        s/\s+/ /g;              # remove excessive whitespaces.
 
        next unless (defined $level);
+       &DEBUG("strip control chars?");
        s/[\cA-\c_]//ig         # remove control characters.
     }
 
@@ -394,7 +395,7 @@ sub IsHostMatch {
     # 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'});
     }
@@ -406,12 +407,10 @@ sub IsHostMatch {
 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;
 }
 
@@ -514,6 +513,9 @@ sub validFactoid {
        /\=\~/ 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;
@@ -549,7 +551,7 @@ sub validFactoid {
        /\\\%/ 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.
@@ -601,11 +603,13 @@ sub Forker {
     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;
@@ -624,12 +628,6 @@ sub Forker {
     }
 }
 
-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});