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

Sanitize nicks in _activenicks

Christoph Berg 22 лет назад
Родитель
Сommit
34c206b9d6
2 измененных файлов с 11 добавлено и 6 удалено
  1. 4 1
      docs/Changelog
  2. 7 5
      modules/Pisg/HTMLGenerator.pm

+ 4 - 1
docs/Changelog

@@ -1,6 +1,9 @@
 pisg (x.xx)
+   Changes by Christoph Berg:
    * Fix problem where NFiles didn't work when the specified values was more
-   than the actual number of logfiles (thanks, Christoph Berg)
+   than the actual number of logfiles.
+   * Sanitize nicks in _activenicks (fixes problem reported by
+   shr3kst3r@hushmail.com/Andreas Blaafladt).
 
 pisg (0.56) - Sat Jun, 19th 2004
    * Fix parsing of energymech kick messages and modes (thanks, optika81)

+ 7 - 5
modules/Pisg/HTMLGenerator.pm

@@ -504,7 +504,7 @@ sub _activenicks
     for (my $i = 0; $i < $self->{cfg}->{activenicks}; $i++) {
         my $c = $i + 1;
         my $nick = $active[$i];
-        my $visiblenick = $active[$i];
+        my $visiblenick;
 
         my $randomline;
         if (not defined $self->{stats}->{sayings}{$nick}) {
@@ -521,9 +521,11 @@ sub _activenicks
             $randomline = $self->_format_line($randomline);
         }
 
-        # Add a link to the nick if there is any
+        # Add a link to the nick if there is any and quote nick
         if ($self->{users}->{userlinks}{$nick}) {
-            $visiblenick = $self->_replace_links($self->{users}->{userlinks}{$nick}, $nick);
+            $visiblenick = $self->_format_word($self->{users}->{userlinks}{$nick}, $nick);
+        } else {
+            $visiblenick = $self->_format_word($nick);
         }
 
         my $color = $self->generate_colors($c);
@@ -1577,10 +1579,10 @@ sub _template_text
 sub _format_word
 {
     # This function formats a word -- should ONLY be called on words used alone (EG: not whole line printed)
-    my ($self, $word) = @_;
+    my ($self, $word, $nick) = @_;
 
     $word = htmlentities($word, $self->{cfg}->{charset});
-    $word = $self->_replace_links($word);
+    $word = $self->_replace_links($word, $nick);
     return $word;
 }