Răsfoiți Sursa

* Applied patch by Hanno Hecker to keep only the last 50 quotes for each
nick while parsing. Saves memory and is probably saner anyway (thanks!).

Christoph Berg 21 ani în urmă
părinte
comite
3923902078
3 a modificat fișierele cu 17 adăugiri și 4 ștergeri
  1. 1 1
      docs/CREDITS
  2. 2 0
      docs/Changelog
  3. 14 3
      modules/Pisg/Parser/Logfile.pm

+ 1 - 1
docs/CREDITS

@@ -54,7 +54,7 @@ Other contributors:
    | Compressed files, addition of --prefix, and sorting of files in logdirs
  * JaMiR0W <jamirow@ig.com.br>
    | Portugese translation
- * Hanno Hecker (Vetinari) <hanno-pisg@bee.de>
+ * Hanno Hecker (Vetinari) <vetinari@ankh-morp.org>
    | Lots of feature additions and code cleanups, thanks!
    | Updates to German translation, some patches for words and the feature
      'most words'.

+ 2 - 0
docs/Changelog

@@ -15,6 +15,8 @@ pisg (0.64) - ??
      LogDirs.
    * No "Userpic" headline was shown when there were only DefaultPics.
    * Make "most used words" case-insensitive.
+   * Applied patch by Hanno Hecker to keep only the last 50 quotes for each
+     nick while parsing. Saves memory and is probably saner anyway (thanks!).
 
 pisg (0.63) - Wed Jan, 12th 2005
    Morten:

+ 14 - 3
modules/Pisg/Parser/Logfile.pm

@@ -405,7 +405,7 @@ sub _parse_file
             }
             $lastnormal = $line;
             $repeated = 0;
-        }
+        } # normal lines
 
         # Match action lines.
         elsif ($hashref = $self->{parser}->actionline($line, $.)) {
@@ -468,7 +468,7 @@ sub _parse_file
 
                 _parse_words($stats, $saying, $nick, $self->{ignorewords_regexp}, $hour);
             }
-        }
+        } # action lines
 
         # Match *** lines.
         elsif (($hashref = $self->{parser}->thirdline($line, $.)) and $hashref->{nick}) {
@@ -530,8 +530,19 @@ sub _parse_file
                     checkname($nick, $newnick, $stats) if ($self->{cfg}->{showmostnicks});
                 }
             }
+        } # *** lines
+
+        unless ($stats->{parsedlines} % 10000) { # keep only recent quotes to same mem
+            foreach my $n (keys %{$lines->{sayings}}) {
+                my $x = @{$lines->{sayings}->{$n}};
+                splice(@{$lines->{sayings}->{$n}}, 0, ($x - 50)) if ($x > 75);
+            }
+            foreach my $n (keys %{$lines->{actionlines}}) {
+                my $y = @{$lines->{actionlines}->{$n}};
+                splice(@{$lines->{actionlines}->{$n}}, 0, ($y - 50)) if ($y > 75);
+            }
         }
-    }
+    } # while(my $line = <LOGFILE>)
 
     $stats->{totallines} = $.;