Ver código fonte

ellipsis after truncated quotes (SF #1708464)

James Wade 14 anos atrás
pai
commit
dcee25ee3f
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      modules/Pisg/Parser/Logfile.pm

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

@@ -376,7 +376,11 @@ sub _parse_file
                     } elsif (!$lines->{sayings}{$nick}) {
                         # Just fill the users first saying in if he hasn't
                         # said anything yet, to get rid of empty quotes.
-                        push @{ $lines->{sayings}{$nick} }, substr($saying, 0, $self->{cfg}->{maxquote});
+                        if ($len > $self->{cfg}->{maxquote} - 3) {
+                            push @{ $lines->{sayings}{$nick} }, substr($saying, 0, $self->{cfg}->{maxquote} - 3) . '...';
+                        } else {
+                            push @{ $lines->{sayings}{$nick} }, $saying;
+                        }
                     }
 
                     $stats->{lengths}{$nick} += $len;