&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.
}
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;
}
sub ircCheck {
-
if (@_) {
&ScheduleThis(60, "ircCheck");
return if ($_[0] eq "2"); # defer.
&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.");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
- }
-
if (!$conn->connected or time() - $msgtime > 3600) {
# todo: shouldn't we use cache{connect} somewhere?
if (exists $cache{connect}) {
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("we have a NULL chan in hash channels? removing!");
- delete $channels{''};
-
- &DEBUG("channels now:");
- foreach (keys %channels) {
- &status(" $_");
+ &WARN("ircCheck: we have a NULL chan in hash channels? removing!");
+ if (exists $channels{''}) {
+ &DEBUG("ircCheck: ok it existed!");
+ } else {
+ &DEBUG("ircCheck: this hsould never happen!");
}
- &DEBUG("channels END");
+ delete $channels{''};
}
&DEBUG("ircstats...");
&DEBUG(" pubsleep: $pubsleep");
&DEBUG(" msgsleep: $msgsleep");
+ &DEBUG(" notsleep: $notsleep");
### USER FILE.
if ($utime_userfile > $wtime_userfile and time() - $wtime_userfile > 3600) {
}
# make backup of important files.
- &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*7);
- &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*7);
- &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*7);
+ &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*3);
+ &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*3);
+ &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*1);
# flush cache{lobotomy}
foreach (keys %{ $cache{lobotomy} }) {
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;
}