]> git.donarmstrong.com Git - infobot.git/commitdiff
- bah, was editting the comments in another xterm but ^C'd it and lost
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 29 Oct 2002 15:33:38 +0000 (15:33 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 29 Oct 2002 15:33:38 +0000 (15:33 +0000)
  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

src/CommandStubs.pl
src/IRC/Schedulers.pl
src/Modules/News.pl

index 7aec2a61eb684a20805f37cae4dbafaf9bce4d85..b94f4a40c68cf54e127f360feae6b8bfefb3742f 100644 (file)
@@ -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;
 
index 7ce4284153c4aef3c72ae42501dc194cdfe3d029..b169c66904aef9bfedb9d3d6471f398b5ed7a578 100644 (file)
@@ -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 {
index 33d8933d86b923f3b833bd29b5cb98ab8abc91aa..478c86104b8782e96101a4fc76278c8bb04baa16 100644 (file)
@@ -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);