changeset 20:21d4f54b2b25

Implement no-lol list
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Tue, 15 Feb 2011 13:09:21 -0600
parents a7406b7600ab
children a54f26f2f7fd
files teh-lol.pl
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/teh-lol.pl
+++ b/teh-lol.pl
@@ -35,16 +35,29 @@
   return Xchat::EAT_NONE;
 }
 
+my @no_lol_list;
+
+if (open FILE, $ENV{"HOME"}."/.xchat2/no-lol") {
+  while (<FILE>) {
+    chomp;
+    push @no_lol_list, $_;
+  }
+  close(FILE);
+}
+
 sub check_lol {
   my $chan = Xchat::get_info("channel");
   my $timesince_lasttalk = time - Xchat::user_info -> {'lasttalk'};
 
-  if ($_[0][1] =~ /\b(l((o|(?<!l)lo)+)l)\b/i #Match stuff like "lol",
-                                             #"loool" and "lololol"
-      and $timesince_lasttalk < 120) {  #Two minutes of not saying
-                                        #anything in the channel
-                                        #counts as idling, so don't
-                                        #pester when idling.
+  #Match stuff like "lol", "loool" and "lololol"
+  if ($_[0][1] =~ /\b(l((o|(?<!l)lo)+)l)\b/i
+
+      #Two minutes of not saying anything in the channel counts as
+      #idling, so don't pester when idling.
+      and $timesince_lasttalk < 120
+
+      #Enemies of the lols are abusing the lol, no lols for them.
+      and not grep(/$_[0][0]/, @no_lol_list) ) {
 
     my $lol = $1;
     my $midlol = $2;