Bläddra i källkod

* Fix wrong references of nicks (thanks, Sascha Wessel)

Morten Brix Pedersen 22 år sedan
förälder
incheckning
f423f4ef38
2 ändrade filer med 9 tillägg och 3 borttagningar
  1. 1 0
      docs/Changelog
  2. 8 3
      modules/Pisg/Parser/Logfile.pm

+ 1 - 0
docs/Changelog

@@ -1,6 +1,7 @@
 pisg (x.xx)
    * Added new option, ShowFoulDecimals which configures the number of
    decimals used in statistics in foul numbers. (thanks, Thorbjörn Svensson)
+   * Fix wrong references of nicks (thanks, Sascha Wessel)
    * HTML documentation now has sane filenames.
    * Documentation has been cleaned up for typos/spelling errors.
 

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

@@ -590,8 +590,14 @@ sub _parse_words
         # Also ignore stuff from URLs.
         next if ($word =~ m/^https?$|^\/\//o);
 
-        $stats->{wordcounts}{$word}++;
-        $stats->{wordnicks}{$word} = $nick;
+	# uniquify nicks
+	if (my $realnick = is_nick($word)) {
+		$stats->{wordcounts}{$realnick}++;
+		$stats->{wordnicks}{$realnick} = $nick;
+	} else {
+		$stats->{wordcounts}{$word}++;
+		$stats->{wordnicks}{$word} = $nick;
+	}
     }
 }
 
@@ -626,7 +632,6 @@ sub _uniquify_nicks {
 	    # The lc() is an attempt at being case insensitive.
 	    if (lc($realnick) ne lc($word)) {
 	        $stats->{wordcounts}{$realnick} += $stats->{wordcounts}{$word};
-	        $stats->{wordnicks}{$realnick}   = $stats->{wordnicks}{$word};
 	        delete $stats->{wordcounts}{$word};
 	        delete $stats->{wordnicks}{$word};
 	    }