Răsfoiți Sursa

Stop sending $hash{channel} to only a few templates, just set it as a
default thing in template_text() so we get rid of some bloat.

Morten Brix Pedersen 25 ani în urmă
părinte
comite
76d5d5cd68
1 a modificat fișierele cu 8 adăugiri și 22 ștergeri
  1. 8 22
      pisg.pl

+ 8 - 22
pisg.pl

@@ -983,6 +983,8 @@ sub template_text
         }
     }
 
+    $hash{channel} = $conf->{channel};
+
     foreach my $key (sort keys %hash) {
         $text =~ s/\[:$key\]/$hash{$key}/;
         $text =~ s/ü/ü/g;
@@ -1902,7 +1904,6 @@ sub longlines
 
         if (@len >= 2) {
             %hash = (
-                channel => $conf->{channel},
                 avg => $totalaverage
             );
 
@@ -1989,11 +1990,7 @@ sub mostfoul
 
        html("</td></tr>");
     } else {
-        my %hash = (
-            channel => $conf->{channel}
-        );
-
-        my $text = template_text('foul3', %hash);
+        my $text = template_text('foul3');
 
         html("<tr><td bgcolor=\"$conf->{hicell}\">$text</td></tr>");
     }
@@ -2035,10 +2032,7 @@ sub mostsad
         }
         html("</td></tr>");
     } else {
-        my %hash = (
-            channel => $conf->{channel}
-        );
-        my $text = template_text('sad3', %hash);
+        my $text = template_text('sad3');
         html("<tr><td bgcolor=\"$conf->{hicell}\">$text</td></tr>");
     }
 }
@@ -2070,13 +2064,11 @@ sub mostop
         }
         html("</td></tr>");
     } else {
-        my %hash = ( channel => $conf->{channel} );
-        my $text = template_text('mostop3', %hash);
+        my $text = template_text('mostop3');
         html("<tr><td bgcolor=\"$conf->{hicell}\">$text</td></tr>");
     }
     if (@deops) {
         my %hash = (
-            channel => $conf->{channel},
             nick => $deops[0],
             deops => $tookop{$deops[0]}
         );
@@ -2095,8 +2087,7 @@ sub mostop
         }
             html("</td></tr>");
     } else {
-        my %hash = ( channel => $conf->{channel} );
-        my $text = template_text('mostdeop3', %hash);
+        my $text = template_text('mostdeop3');
         html("<tr><td bgcolor=\"$conf->{hicell}\">$text");
     }
 }
@@ -2178,11 +2169,8 @@ sub mostsmiles
         html("</td></tr>");
 
     } else {
-        my %hash = (
-            channel => $conf->{channel}
-        );
 
-        my $text = template_text('smiles3', %hash);
+        my $text = template_text('smiles3');
         html("<tr><td bgcolor=\"$conf->{hicell}\">$text</td></tr>");
     }
 }
@@ -2274,13 +2262,11 @@ td {
 <div align="center">
 HTML
 my %hash = (
-    channel => $conf->{channel},
     network => $conf->{network},
     maintainer => $conf->{maintainer},
     time => $time,
     days => $days,
-    nicks => $nicks,
-    channel => $conf->{channel}
+    nicks => $nicks
 );
 print OUTPUT "<span class=\"title\">" . template_text('pagetitle1', %hash) . "</span><br>";
 print OUTPUT "<br>";