Explorar el Código

* Added new option, ShowFoulDecimals which configures the number of
decimals used in statistics in foul numbers. (thanks, Thorbjörn Svensson)

Morten Brix Pedersen hace 22 años
padre
commit
db8e25d9c3
Se han modificado 4 ficheros con 44 adiciones y 1 borrados
  1. 4 0
      docs/Changelog
  2. 35 0
      docs/pisg-doc.sgml
  3. 1 0
      modules/Pisg.pm
  4. 4 1
      modules/Pisg/HTMLGenerator.pm

+ 4 - 0
docs/Changelog

@@ -1,3 +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)
+
 pisg (0.57) - Sat Aug, 28th 2004
    Changes by Christoph Berg:
    * Fix problem where NFiles didn't work when the specified values was more

+ 35 - 0
docs/pisg-doc.sgml

@@ -1506,6 +1506,41 @@
     </refsect1>
     </refentry>
 
+    <!-- *** SHOWFOULDECIMALS *** -->
+    <refentry id="ShowFoulDecimals">
+
+    <refmeta> <refentrytitle>ShowFoulDecimals</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>ShowFoulDecimals</refname>
+    <refpurpose>set how many decimals to show</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <channel="#channel">
+         Logfile = "channel.log"
+         Format = "bobot"
+         ShowFoulDecimals = "2"
+        </channel>
+
+        <set ShowFoulDecimals="1">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    By default, pisg uses 1 decimal. With this option you could change 
+    it to whatever you like. Negative is treated as the default value.
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> 1 decimal </para>
+    </refsect1>
+    </refentry>
+
     <!-- *** SHOWFOULLINE *** -->
     <refentry id="ShowFoulLine">
 

+ 1 - 0
modules/Pisg.pm

@@ -148,6 +148,7 @@ sub get_default_config_settings
         showkickline => 1,
         showactionline => 1,
         showfoulline => 0,
+        showfouldecimals => 1,
         showshoutline => 1,
         showviolentlines => 1,
         showrandquote => 1,

+ 4 - 1
modules/Pisg/HTMLGenerator.pm

@@ -1120,7 +1120,10 @@ sub _mostfoul
         if ($self->{topactive}{$nick} || !$self->{cfg}->{showonlytop}) {
           if ($self->{stats}->{lines}{$nick} > 15) {
               $spercent{$nick} = $self->{stats}->{foul}{$nick} / $self->{stats}->{words}{$nick} * 100;
-              $spercent{$nick} =~ s/(\.\d)\d+/$1/;
+	      
+              my $dec = $self->{cfg}->{showfouldecimals};
+              $dec = 1 if($dec < 0); # default to 1
+              $spercent{$nick} =~ s/(\.\d{$dec})\d+/$1/;
           }
         }
     }