From: dms Date: Tue, 29 Oct 2002 15:33:38 +0000 (+0000) Subject: - bah, was editting the comments in another xterm but ^C'd it and lost X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b2ea176f79c18483ad6195bd37f9835d6ae9f034;p=infobot.git - bah, was editting the comments in another xterm but ^C'd it and lost it. should be self-explanitory, the changes that is. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@562 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 7aec2a6..b94f4a4 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -753,7 +753,7 @@ sub lart { } sub DebianNew { - my $idx = "debian/Packages-woody.idx"; + my $idx = "debian/Packages-sid.idx"; my $error = 0; my %pkg; my @new; @@ -762,7 +762,7 @@ sub DebianNew { $error++ unless ( -e "$idx-old"); if ($error) { - $error = "no woody/woody-old index file found."; + $error = "no sid/sid-old index file found."; &ERROR("Debian: $error"); &msg($who, $error); return; @@ -785,7 +785,7 @@ sub DebianNew { next if (/^\*/); next if (exists $pkg{$_}); - push(@new); + push(@new, $_); } close IDX1; diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index 7ce4284..b169c66 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -194,40 +194,38 @@ sub logLoop { } ### check if all the logs exceed size. - if (opendir(LOGS, $bot_log_dir)) { - my $tsize = 0; - my (%age, %size); - - while (defined($_ = readdir LOGS)) { - my $logfile = "$bot_log_dir/$_"; + if (!opendir(LOGS, $bot_log_dir)) { + &WARN("logLoop: could not open dir '$bot_log_dir'"); + return; + } - next unless ( -f $logfile); - my $size = -s $logfile; - my $age = (stat $logfile)[9]; + my $tsize = 0; + my (%age, %size); + while (defined($_ = readdir LOGS)) { + my $logfile = "$bot_log_dir/$_"; - $age{$age} = $logfile; - $size{$logfile} = $size; + next unless ( -f $logfile); - $tsize += $size; - } - closedir LOGS; - - my $delete = 0; - while ($tsize > $param{'maxLogSize'}) { - &status("LOG: current size > max ($tsize > $param{'maxLogSize'})"); - my $oldest = (sort {$a <=> $b} keys %age)[0]; - &status("LOG: unlinking $age{$oldest}."); - unlink $age{$oldest}; - $tsize -= $oldest; - $delete++; - } + my $size = -s $logfile; + my $age = (stat $logfile)[9]; + $age{$age} = $logfile; + $size{$logfile} = $size; + $tsize += $size; + } + closedir LOGS; - ### TODO: add how many b,kb,mb removed? - &status("LOG: removed $delete logs.") if ($delete); - } else { - &WARN("could not open dir $bot_log_dir"); + my $delete = 0; + while ($tsize > $param{'maxLogSize'}) { + &status("LOG: current size > max ($tsize > $param{'maxLogSize'})"); + my $oldest = (sort {$a <=> $b} keys %age)[0]; + &status("LOG: unlinking $age{$oldest}."); + unlink $age{$oldest}; + $tsize -= $oldest; + $delete++; } + ### TODO: add how many b,kb,mb removed? + &status("LOG: removed $delete logs.") if ($delete); } sub seenFlushOld { diff --git a/src/Modules/News.pl b/src/Modules/News.pl index 33d8933..478c861 100644 --- a/src/Modules/News.pl +++ b/src/Modules/News.pl @@ -789,6 +789,12 @@ sub latest { if (!$flag) { return unless ($unread); + if ($::cache{newsTime} - time() < 5) { + &::status("news: not displaying latest notice to $who/$chan."); + return; + } + + $::cache{newsTime} = time(); my $reply = "There are unread news in $chan ($unread unread, $total total). /msg $::ident news $::chan latest"; $reply .= " If you don't want further news notification, /msg $::ident news unnotify" if ($unread == $total); &::notice($who, $reply);