Просмотр исходного кода

Add new 'show_lastseen' feature

Morten Brix Pedersen 25 лет назад
Родитель
Сommit
ec48ca61f1
4 измененных файлов с 17 добавлено и 3 удалено
  1. 3 0
      docs/CONFIG-README
  2. 8 0
      lang.txt
  3. 2 2
      modules/Pisg.pm
  4. 4 1
      modules/Pisg/Parser/Logfile.pm

+ 3 - 0
docs/CONFIG-README

@@ -131,6 +131,9 @@ show_wpl            1 or 0, this enables pisg to show 'words per line' for
 
 show_cpl            Same as above, this is just 'characters per line'
 
+show_lastseen       1 or 0, display a coloumn showing when the user was last
+                    on the channel (how many days ago)
+
 show_words          1 or 0, this will enable/disable both of the 2 above
                     options.
 

+ 8 - 0
lang.txt

@@ -142,7 +142,11 @@ show_words = "Number of Words"
 show_time = "When?"
 show_wpl = "Words per line"
 show_cpl = "Chars per line"
+show_lastseen = "Last seen"
 lastused = "Last Used by"
+lastseen1 = "day ago"
+lastseen2 = "days ago"
+today = "Today"
 pagetitle1 = "[:channel] @ [:network] stats by [:maintainer]"
 pagetitle2 = "Statistics generated on "
 pagetitle3 = "During this [:days]-day reporting period, a total of <b>[:nicks]</b> different nicks were represented on [:channel]."
@@ -378,7 +382,11 @@ show_words = "Antal af ord"
 show_time = "Hvornår?"
 show_wpl = "Ord pr. linje"
 show_cpl = "Bogstaver pr. linje"
+show_lastseen = "Sidst set"
 lastused = "Sidst brugt af"
+lastseen1 = "dage siden"
+lastseen2 = "dage siden"
+today = "I dag"
 pagetitle1 = "[:channel] @ [:network] statistikker af [:maintainer]"
 pagetitle2 = "Statistikker genereret "
 pagetitle3 = "Igennem denne [:days]-dages periode, har der været <b>[:nicks]</b> forskellige nicks på [:channel]."

+ 2 - 2
modules/Pisg.pm

@@ -164,6 +164,7 @@ sub get_default_config_settings
         show_words => 0,
         show_wpl => 0,
         show_cpl => 0,
+        show_lastseen => 0,
         show_legend => 1,
         show_kickline => 1,
         show_actionline => 1,
@@ -294,7 +295,7 @@ sub init_config
                     $nick = $1;
                     add_alias($nick, $nick);
                 } else {
-                    print STDERR "Warning: no nick specified in $self->{cfg}->{configfile} on line $lineno\n";
+                    print STDERR "Warning: No nick specified in $self->{cfg}->{configfile} on line $lineno\n";
                     next;
                 }
 
@@ -375,7 +376,6 @@ sub init_config
         }
 
         close(CONFIG);
-
     }
 }
 

+ 4 - 1
modules/Pisg/Parser/Logfile.pm

@@ -152,7 +152,6 @@ sub _parse_file
     my $lastnormal = "";
     my $repeated;
 
-
     while(my $line = <LOGFILE>) {
         $line = _strip_mirccodes($line);
         $linecount++;
@@ -192,6 +191,7 @@ sub _parse_file
                     $stats->{times}{$hour}++;
 
                     $stats->{lines}{$nick}++;
+                    $stats->{lastvisited}{$nick} = $stats->{days};
                     $stats->{line_times}{$nick}[int($hour/6)]++;
 
                     # Count up monologues
@@ -275,6 +275,7 @@ sub _parse_file
                 $stats->{actions}{$nick}++;
                 push @{ $lines->{actionlines}{$nick} }, $line;
                 $stats->{lines}{$nick}++;
+                $stats->{lastvisited}{$nick} = $stats->{days};
                 $stats->{line_times}{$nick}[int($hour/6)]++;
 
                 if ($saying =~ /^($self->{cfg}->{violent}) (\S+)/) {
@@ -320,6 +321,8 @@ sub _parse_file
                 # Timestamp collecting
                 $stats->{times}{$hour}++;
 
+                $stats->{lastvisited}{$nick} = $stats->{days};
+
                 if (defined($kicker)) {
                     unless (is_ignored($kicker)) {
                         $stats->{kicked}{$kicker}++;