Forgot to actually creat the _snarfedUrls attribute.

This commit is contained in:
Jeremy Fincher 2003-11-07 14:10:28 +00:00
parent 867814eb1d
commit 4200349aea

View File

@ -155,13 +155,16 @@ def urlSnarfer(f):
def newf(self, irc, msg, match, *L): def newf(self, irc, msg, match, *L):
now = time.time() now = time.time()
cutoff = now - conf.snarfThrottle cutoff = now - conf.snarfThrottle
while self._snarfedUrls and self._snarfedUrls[0][2] < cutoff: q = getattr(self, '_snarfedUrls', None)
self._snarfedUrls.dequeue() if q is None:
q = structures.fastqueue()
while q and q[0][2] < cutoff:
q.dequeue()
url = match.group(0) 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.') debug.msg('Refusing to snarf %s.')
else: else:
self._snarfedUrls.enqueue((url, msg.args[0], now)) q.enqueue((url, msg.args[0], now))
f(self, irc, msg, match, *L) f(self, irc, msg, match, *L)
newf = types.FunctionType(newf.func_code, newf.func_globals, newf = types.FunctionType(newf.func_code, newf.func_globals,
f.func_name, closure=newf.func_closure) f.func_name, closure=newf.func_closure)