From 853210fb2fa6b0df1ac851c8d88d11c0eed0fe21 Mon Sep 17 00:00:00 2001
From: FurryHead <furryhead14@yahoo.com>
Date: Sat, 18 Jun 2011 15:10:28 +0000
Subject: [PATCH] Added doKick and kick event; BlockBot plugin thanks to
 aj00200; Now using class User(str); Misc plugin fixes

---
 plugins/bbot.py | 75 -------------------------------------------------
 1 file changed, 75 deletions(-)
 delete mode 100644 plugins/bbot.py

diff --git a/plugins/bbot.py b/plugins/bbot.py
deleted file mode 100644
index 394c166..0000000
--- a/plugins/bbot.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import re
-import time
- 
-@plugin
-class Blockbot(object):
-    def __init__(self, server):
-        self.server = server
-        self.prnt = server.prnt
-        
-        self.server.handle("message", self.handle_message)
- 
-        findlist = [
-            'you will be  unable to connect to freenode  unless you are using sasl'
-        ]
-        self.mps_limit = 4
-        self.storage_time = 25
-        self.repeat_limit = 3
-        self.repeat_1word = 4
- 
-        # Compile Spam Strings        
-        self.findlist = []
-        if findlist:
-            for each in findlist:
-                self.findlist.append(re.compile(each))
- 
-        # Load Default Data
-        self.msglist = []
-        #self.lastnot = ('BBot', time.time(), 'sdkljfls')
- 
-    def handle_message(self, channel, nick, message):
-        """ Called when a message is received """
-        self.msglist.insert(0, (nick, channel, message,
-                                time.time()))
- 
-        # Check for spam strings
-        ldata = message.lower()
-        for each in self.findlist:
-            if re.search(each, ldata):
-                self.server.doKick(channel, nick, 'You have matched a spam string and have been banned, if you this is a mistake, contact a channel op to be unbanned')
-                return
- 
-        # Extract messages by this user
-        user_msgs = []
-        for msg in self.msglist:
-            if msg[0] == nick:
-                user_msgs.append((nick, msg[1], msg[2], msg[3]))
- 
-        # Check for flooding
-        if self.get_mps(user_msgs) > self.mps_limit:
-            self.server.doKick(channel, nick,'Please do not flood')
-            self.msglist.pop(0)
- 
-        # Check for repeats
-        strings = []
-        repeats = 0
-        for msg in user_msgs:
-            if msg[2] not in strings:
-                strings.append(msg[2])
-            else:
-                repeats += 1
-        if repeats > self.repeat_limit-1:
-            self.server.doKick(channel, nick, 'Do not repeat yourself...')
-            self.msglist.pop(0)
- 
-        # Clear out old messages
-        now = time.time()
-        for msg in self.msglist:
-            if now - msg[3] > self.storage_time:
-                self.msglist.remove(msg)
-       
-    def get_mps(self, user_msgs):
-        '''Count the number of messages sent per second'''
-        time_range = user_msgs[0][3] - user_msgs[-1][3]
-        mps =  len(user_msgs) / time_range
-        return mps
-- 
GitLab