&leakCheck(2); # mandatory
&ignoreCheck(1); # mandatory
&seenFlushOld(2);
- &ircCheck(1); # mandatory
+ &ircCheck(2); # mandatory
&miscCheck(1); # mandatory
&miscCheck2(2); # mandatory
&shmFlush(1); # mandatory
next unless (&validChan($chan));
my $limitplus = &getChanConfDefault("chanlimitcheckPlus", 5, $chan);
- my $newlimit = scalar(keys %{$channels{$chan}{''}}) + $limitplus;
+ my $newlimit = scalar(keys %{ $channels{$chan}{''} }) + $limitplus;
my $limit = $channels{$chan}{'l'};
- if (defined $limit and scalar keys %{$channels{$chan}{''}} > $limit) {
+ if (defined $limit and scalar keys %{ $channels{$chan}{''} } > $limit) {
&FIXME("LIMIT: set too low!!! FIXME");
### run NAMES again and flush it.
}
- next unless (!defined $limit or $limit != $newlimit);
+ next unless (!defined $limit);
+ if ($limit == $newlimit) {
+ $cache{chanlimitChange}{$chan} = time();
+ next;
+ }
if (!exists $channels{$chan}{'o'}{$ident}) {
&status("ChanLimit: dont have ops on $chan.") unless (exists $cache{warn}{chanlimit}{$chan});
$cache{warn}{chanlimit}{$chan} = 1;
- ### TODO: check chanserv?
+ &chanServCheck($chan);
next;
}
delete $cache{warn}{chanlimit}{$chan};
&status("ChanLimit: setting for first time or from netsplit, for $chan");
}
- if (exists $cache{ "chanlimitChange_$chan" }) {
- my $delta = time() - $cache{ "chanlimitChange_$chan" };
+ if (exists $cache{chanlimitChange}{$chan}) {
+ my $delta = time() - $cache{chanlimitChange}{$chan};
if ($delta < $interval*60) {
&DEBUG("not going to change chanlimit! ($delta<$interval*60)");
return;
}
&rawout("MODE $chan +l $newlimit");
- $cache{ "chanlimitChange_$chan" } = time();
+ $cache{chanlimitChange}{$chan} = time();
}
}
}
foreach $s1 (keys %netsplitservers) {
- foreach $s2 (keys %{$netsplitservers{$s1}}) {
+ foreach $s2 (keys %{ $netsplitservers{$s1} }) {
if (time() - $netsplitservers{$s1}{$s2} > 3600) {
&status("netsplit between $s1 and $s2 appears to be stale.");
delete $netsplitservers{$s1}{$s2};
my $interval = &getChanConfDefault("floodCycle",60);
foreach $who (keys %flood) {
- foreach (keys %{$flood{$who}}) {
+ foreach (keys %{ $flood{$who} }) {
if (!exists $flood{$who}{$_}) {
&WARN("flood{$who}{$_} undefined?");
next;
delete $sched{"leakCheck"}{RUNNING};
}
- # flood.
+ # flood. this is dealt with in floodLoop()
foreach $blah1 (keys %flood) {
foreach $blah2 (keys %{ $flood{$blah1} }) {
$count += scalar(keys %{ $flood{$blah1}{$blah2} });
$count += scalar(keys %{ $floodjoin{$blah1}{$blah2} });
}
}
- &DEBUG("leak: hash flood has $count total keys.",2);
+ &DEBUG("leak: hash floodjoin has $count total keys.",2);
# floodwarn.
$count = scalar(keys %floodwarn);
}
}
+ # chanstats
+ $count = scalar(keys %chanstats);
+ &DEBUG("leak: hash chanstats has $count total keys.",2);
+
+ # nuh.
my $delete = 0;
foreach (keys %nuh) {
next if (&IsNickInAnyChan($_));
}
sub ircCheck {
-
if (@_) {
&ScheduleThis(60, "ircCheck");
return if ($_[0] eq "2"); # defer.
delete $sched{"ircCheck"}{RUNNING};
}
- my @array = grep !/^_default$/, keys %chanconf;
- my $iconf = scalar(@array);
- my $inow = scalar(keys %channels);
+ my @x = &getJoinChans();
+ my $iconf = scalar( @x );
+ my $inow = scalar( keys %channels );
if ($iconf > 2 and $inow * 2 <= $iconf) {
&FIXME("ircCheck: current channels * 2 <= config channels. FIXME.");
- }
-
- # chanserv ops.
- foreach ( &ChanConfList("chanServ_ops") ) {
- next if (exists $channels{$chan}{'o'}{$ident});
-
- &status("ChanServ ==> Requesting ops for $chan. (3)");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
+ @joinchan = @x;
+ &joinNextChan();
}
if (!$conn->connected or time() - $msgtime > 3600) {
if ($ident !~ /^\Q$param{ircNick}\E$/) {
# this does not work unfortunately.
&WARN("ircCheck: ident($ident) != param{ircNick}($param{IrcNick}).");
+
+ # this check is misleading... perhaps we should do a notify.
if (! &IsNickInAnyChan( $param{ircNick} ) ) {
&DEBUG("$param{ircNick} not in use... changing!");
&nick( $param{ircNick} );
}
}
- &joinNextChan();
- # if scalar @joinnext => join more channels
- # else check for chanserv.
-
if (grep /^\s*$/, keys %channels) {
&WARN("ircCheck: we have a NULL chan in hash channels? removing!");
if (exists $channels{''}) {
### this is semi-scheduled
sub getNickInUse {
+ &DEBUG("gNIU: ident => $ident, ircNick => $param{'ircNick'}");
if ($ident eq $param{'ircNick'}) {
&status("okay, got my nick back.");
return;
foreach (@list) {
my $age = &getFactInfo($_, "modified_time");
+
if (!defined $age or $age !~ /^\d+$/) {
- &WARN("age == NULL or not numeric.");
+ if (scalar @list > 50) {
+ if (!$cache{warnDel}) {
+ &WARN("list is over 50 (".scalar(@list)."... giving it a miss.");
+ $cache{warnDel} = 1;
+ last;
+ }
+ }
+
+ &WARN("old cruft (no time): $_");
+ &delFactoid($_);
next;
}
}
return unless ($backup);
+ my $age = &Time2String(time() - (stat $file)[9]);
+
### TODO: do internal copying.
- &status("Backup: $file to $file~");
+ &status("Backup: $file ($age)");
CORE::system("/bin/cp $file $file~");
}