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

I've been meaning to do this for months.



Two patches, the first should be self-explanatory.  The second,
however, requires a brief blurb: 

Symptom:
<Masque/#waterglass> beeer++
$term is beeer, $inc is ++

Okay, good bot.

<Masque/#waterglass> beeer++;
$term is beeer;, $inc is ++

Uhoh.

Even more fun was the 'foo++foo++ becomes foofoo++++' issue.  
Should be all better with the second patch down below, however.

Should be self-explanatory from here.  I have tested these and
found no harmful side-effects.  Your results may vary.

Masque.

--- stock/infobot-0.44.4/src/Process.pl Tue Jan  4 20:48:06 2000
+++ Process.pl  Wed Apr 12 13:26:34 2000
@@ -15,6 +15,7 @@
     $message =~ s/[\cA-\c_]//ig; # strip control characters

     $addressed = 0;
+    $karma = 0;                # 12Apr2k - Masque

     return 'ANTIHELP' if $instance =~ /antihelp/;

@@ -326,8 +327,12 @@
            if (($result eq 'NOREPLY') or ($who eq 'NOREPLY')) {
                return '';
            }
+         # This fixes the problem of short karma strings (masque++ for
+         # example) being ignored.   -- Masque, 12Apr2K
+           if ($message =~ /(?:\+\+|--)/) { $karma = 1; }

            if (!$finalQMark and !$addressed and !$tell_obj and
+               !$karma and
                ($input_message_length < getparam('minVolunteerLength'))) {
                $in = '';
                return 'NOREPLY';

--- stock/infobot-0.44.4/src/Statement.pl       Tue Jan  4 20:30:31 2000
+++ Statement.pl        Wed Apr 12 14:24:56 2000
@@ -32,9 +32,12 @@


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

-       if ($in =~ /(\(.*?\)|\S+)(\+\+|--)/) {
+       # Hacked to allow multiple karma per line and to fix
+       # related issues.  foo++foo++ no longer becomes
+       # foofoo++++.     - Masque, 12Apr2K
+       while ($in =~ s/(\(.*?\)|[^(++)(--)\s]+)(\+\+|--)//) {
             my($term,$inc) = ($1,$2);

            $term = lc($term);
@@ -58,8 +61,8 @@
            } elsif ($inc eq '--') {
                $plusplus{$term}--;
            }
-           return 'NOREPLY';
        }
+       return 'NOREPLY' if $karma;
     }

     my($theType);