}
sub DebianNew {
- my $idx = "debian/Packages-woody.idx";
+ my $idx = "debian/Packages-sid.idx";
my $error = 0;
my %pkg;
my @new;
$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;
next if (/^\*/);
next if (exists $pkg{$_});
- push(@new);
+ push(@new, $_);
}
close IDX1;
}
### 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 {
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);