&kernelLoop(2);
&wingateWriteFile(2);
&factoidCheck(2); # takes a couple of seconds on a 486. defer it
-# todo: convert to new format... or nuke altogether.
+# TODO: convert to new format... or nuke altogether.
&newsFlush(1);
- # todo: squeeze this into a one-liner.
+ # TODO: squeeze this into a one-liner.
# my $count = map { exists $sched{$_}{TIME} } keys %sched;
my $count = 0;
foreach (keys %sched) {
next unless (time() > $t);
- # todo: show how old it was.
+ # TODO: show how old it was.
delete $::news{$chan}{$item};
&status("NEWS: (newsflush) deleted '$item'");
$delete++;
$none{$chan} = 1 if ($total == $i);
}
- # todo: flush users aswell.
+ # TODO: flush users aswell.
my $duser = 0;
foreach $chan (keys %::newsuser) {
next if (exists $none{$chan});
}
if (defined $limit and scalar keys %{ $channels{$chan}{''} } > $limit) {
- &FIXME("LIMIT: set too low!!! FIXME");
+ &FIXME("LIMIT: set too low!!!");
### run NAMES again and flush it.
}
my $iconf = scalar( @x );
my $inow = scalar( keys %channels );
if ($iconf > 2 and $inow * 2 <= $iconf) {
- &FIXME("ircCheck: current channels * 2 <= config channels. FIXME.");
- &FIXME("ircCheck: iconf = $iconf");
- &FIXME("ircCheck: inow = $inow");
+ &FIXME("ircCheck: current channels ($inow) * 2 <= config channels ($iconf).");
# @joinchan = @x;
&joinNextChan();
}
- # debug. needed for testing
- open(OUT, ">>irccheck.log");
- my $t = scalar(localtime);
- printf OUT "%s: conn->connected = %s\n", $t, $conn->connected();
- printf OUT "%s: time()-msgtime = %d\n", $t, time() - $msgtime;
- close OUT;
+ # TODO: fix on_disconnect()
- if (!$conn->connected or time() - $msgtime > 3600) {
- # todo: shouldn't we use cache{connect} somewhere?
+ if (time() - $msgtime > 3600) {
+ # TODO: shouldn't we use cache{connect} somewhere?
if (exists $cache{connect}) {
&WARN("ircCheck: no msg for 3600 and disco'd! reconnecting!");
$msgtime = time(); # just in case.
my ($shmid, $size) = ($2,$5);
next unless ($shmid != $shm and $size == 2000);
my $z = &shmRead($shmid);
- if ($z =~ /^(\d+): /) {
- my $time = $1;
+ if ($z =~ /^(\S+):(\d+):(\d+): /) {
+ my $n = $1;
+ my $pid = $2;
+ my $time = $3;
next if (time() - $time < 60*60);
-
+ # FIXME remove not-pid shm if parent process dead
+ next if ($pid == $bot_pid);
+ # don't touch other bots, if they're running.
+ next unless ($param{ircNick} =~ /^\Q$n\E$/);
} else {
-# &DEBUG("shm: $shmid is not ours or old blootbot => ($z)");
-# next;
+ &DEBUG("shm: $shmid is not ours or old blootbot => ($z)");
+ next;
}
&status("SHM: nuking shmid $shmid");
closedir DEBIAN;
# compress logs that should have been compressed.
- # todo: use strftime?
+ # TODO: use strftime?
my ($day,$month,$year) = (gmtime(time()))[3,4,5];
my $date = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
undef @wingateNow;
}
-### TODO.
+### TODO: ??
sub wingateWriteFile {
if (@_) {
&ScheduleThis(60, "wingateWriteFile");
my $time = time();
foreach (@list) {
- my $age = &getFactInfo($_, "modified_time");
+ my $age = &getFactInfo($_, "modified_time");
if (!defined $age or $age !~ /^\d+$/) {
if (scalar @list > 50) {