]> gitweb.pimeys.fr Git - bots/saturnin.git/blobdiff - saturnin.py
jben is trying harder
[bots/saturnin.git] / saturnin.py
index f2b432c5f5a9326a9158148e19e7223ce22e83d2..3b43531fb133e9c3f8d04afd321438432c90e348 100755 (executable)
@@ -56,6 +56,11 @@ def is_something(chain,matches,avant=u".*(?:^| )",apres=u"(?:$|\.| |,|;).*",case
 regexp_pan = re.compile(u".*(" + "|".join(config.killwords) + u").*")
 def is_pan(chain):
     return regexp_pan.match(unicode(chain,"utf8").lower())
+def ignore_pan(serv, ev):
+    """Retourne ``True`` si il faut ignorer ce pan."""
+    for (blackmask, exceptmask) in config.ignored_pan_masks:
+        usermask = ev.source()
+        return bool(irclib.mask_matches(usermask, blackmask) and not irclib.mask_matches(usermasl, exceptmask))
 
 class UnicodeBotError(Exception):
     pass
@@ -494,6 +499,8 @@ class Saturnin(ircbot.SingleServerIRCBot):
                 self.sendscores(auteur)
         else:
             if is_pan(message):
+                if ignore_pan(serv, ev):
+                    return
                 self.shot(channel, auteur)
     
     def on_action(self, serv, ev):