Fixed some bugs.

This commit is contained in:
Jeremy Fincher 2003-11-08 00:10:09 +00:00
parent 143295104a
commit b4e12a10bc
2 changed files with 9 additions and 3 deletions

View File

@ -219,7 +219,10 @@ class ConfigurableDictionary(object):
def get(self, name, channel=None):
name = callbacks.canonicalName(name)
if channel is not None:
return self.channels[channel][name]
try:
return self.channels[channel][name]
except KeyError:
return self.defaults[name]
else:
return self.defaults[name]

View File

@ -35,12 +35,14 @@ Includes various accessories for callbacks.Privmsg based callbacks.
import fix
import time
import types
import conf
import ircdb
import ircutils
import callbacks
import structures
def getChannel(msg, args):
"""Returns the channel the msg came over or the channel given in args.
@ -157,11 +159,12 @@ def urlSnarfer(f):
cutoff = now - conf.snarfThrottle
q = getattr(self, '_snarfedUrls', None)
if q is None:
q = structures.fastqueue()
q = structures.smallqueue()
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], q):
if any(lambda t: t[0] == url and t[1] == msg.args[0], q) and \
not world.testing:
debug.msg('Refusing to snarf %s.')
else:
q.enqueue((url, msg.args[0], now))