From 4200349aea4caf687cb9bc17cb9ac9d7ba7ab8b5 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 7 Nov 2003 14:10:28 +0000 Subject: [PATCH] Forgot to actually creat the _snarfedUrls attribute. --- src/privmsgs.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/privmsgs.py b/src/privmsgs.py index 54634c060..e723236ab 100644 --- a/src/privmsgs.py +++ b/src/privmsgs.py @@ -155,13 +155,16 @@ def urlSnarfer(f): def newf(self, irc, msg, match, *L): now = time.time() cutoff = now - conf.snarfThrottle - while self._snarfedUrls and self._snarfedUrls[0][2] < cutoff: - self._snarfedUrls.dequeue() + q = getattr(self, '_snarfedUrls', None) + if q is None: + q = structures.fastqueue() + while q and q[0][2] < cutoff: + q.dequeue() url = match.group(0) - if any(lambda t: t[0]==url and t[1]==msg.args[0], self._snarfedUrls): + if any(lambda t: t[0] == url and t[1] == msg.args[0], q): debug.msg('Refusing to snarf %s.') else: - self._snarfedUrls.enqueue((url, msg.args[0], now)) + q.enqueue((url, msg.args[0], now)) f(self, irc, msg, match, *L) newf = types.FunctionType(newf.func_code, newf.func_globals, f.func_name, closure=newf.func_closure)