[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

REVISED PATCH



This replaces the multi-line karma patch from yesterday.
This limits karma to +/- 1 per line per item.  This avoids
people giving each other 55 karma in one line.  (Thanks
for being my test subject, dha.  ;)

--- stock/infobot-0.44.4/src/Statement.pl       Tue Jan  4 20:30:31 2000
+++ Statement.pl        Thu Apr 13 11:26:21 2000
@@ -32,12 +32,21 @@


     if (getparam('plusplus')) {
-       $in =~ s/(--|\+\+)(\(.*?\)|\S+)/$2$1/;
+       $in =~ s/\W(--|\+\+)(\(.*?\)|[^(++)(--)\s]+)/$2$1/;

-       if ($in =~ /(\(.*?\)|\S+)(\+\+|--)/) {
-            my($term,$inc) = ($1,$2);
+       # Hacked to allow multiple karma per line and to fix
+       # related issues.  foo++foo++ no longer becomes
+       # foofoo++++.     - Masque, 12Apr2K
+       # ...and to allow only one karma point per item
+       # per line.       - Masque, 13Apr2K
+
+       my %k_limit;

+       while ($in =~ s/(\(.*?\)|[^(++)(--)\s]+)(\+\+|--)//) {
+            my($term,$inc) = ($1,$2);
            $term = lc($term);
+           next if exists $k_limit{$term};
+           $k_limit{$term} = 1;

            # try to normalize phrases
            $term =~ s/^\((.*)\)$/$1/;
@@ -58,8 +67,8 @@
            } elsif ($inc eq '--') {
                $plusplus{$term}--;
            }
-           return 'NOREPLY';
        }
+       return 'NOREPLY' if $karma;
     }

     my($theType);