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): def get(self, name, channel=None):
name = callbacks.canonicalName(name) name = callbacks.canonicalName(name)
if channel is not None: if channel is not None:
return self.channels[channel][name] try:
return self.channels[channel][name]
except KeyError:
return self.defaults[name]
else: else:
return self.defaults[name] return self.defaults[name]

View File

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