From 5c2b91bdc2f854ca9036eecab0a4cba376066810 Mon Sep 17 00:00:00 2001 From: Thorsten Date: Fri, 20 Nov 2015 22:23:31 +0100 Subject: [PATCH] fix totally wrong rate limit storage initialization --- common.py | 2 ++ urlbot.py | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index 39b1e48..39a1a85 100644 --- a/common.py +++ b/common.py @@ -15,6 +15,8 @@ RATE_INTERACTIVE = 0x04 RATE_CHAT = 0x08 RATE_URL = 0x10 +rate_limit_classes = (RATE_CHAT, RATE_GLOBAL, RATE_NO_SILENCE, RATE_INTERACTIVE, RATE_URL) + BUFSIZ = 8192 EVENTLOOP_DELAY = 0.100 # seconds USER_AGENT = '''Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.0''' diff --git a/urlbot.py b/urlbot.py index a07a667..4af4230 100755 --- a/urlbot.py +++ b/urlbot.py @@ -7,10 +7,9 @@ import sys import time from common import conf_load, conf_save, \ - extract_title, RATE_GLOBAL, RATE_CHAT + extract_title, RATE_GLOBAL, RATE_CHAT, rate_limit_classes from idlebot import IdleBot, start from plugins import ( - ptypes as plugin_ptypes, plugins as plugin_storage, ptypes_COMMAND, plugin_enabled_get, @@ -38,8 +37,8 @@ class UrlBot(IdleBot): def __init__(self, jid, password, rooms, nick): super(UrlBot, self).__init__(jid, password, rooms, nick) - self.hist_ts = {p: [] for p in plugin_ptypes} - self.hist_flag = {p: True for p in plugin_ptypes} + self.hist_ts = {p: [] for p in rate_limit_classes} + self.hist_flag = {p: True for p in rate_limit_classes} self.add_event_handler('message', self.message)