From cf1c3a84b9db89672c48d002a0369689597377dc Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 11 Feb 2004 06:20:29 +0000 Subject: [PATCH] Made Sen case-insensitive (again...) --- plugins/Seen.py | 10 ++++++++++ src/plugins.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/Seen.py b/plugins/Seen.py index 171084635..70d2ea2e7 100644 --- a/plugins/Seen.py +++ b/plugins/Seen.py @@ -57,7 +57,17 @@ import privmsgs import registry import callbacks +def ircToLowerOrInt(x): + if isinstance(x, int): + return x + else: + return ircutils.toLower(x) + +class IrcStringAndIntDict(utils.InsensitivePreservingDict): + key = staticmethod(ircToLowerOrInt) + class SeenDB(plugins.ChannelUserDB): + IdDict = IrcStringAndIntDict def serialize(self, v): return list(v) diff --git a/src/plugins.py b/src/plugins.py index 4487d1e0e..e18d2fce2 100644 --- a/src/plugins.py +++ b/src/plugins.py @@ -161,6 +161,7 @@ class ChannelDBHandler(object): class ChannelUserDictionary(UserDict.DictMixin): + IdDict = dict def __init__(self): self.channels = ircutils.IrcDict() @@ -169,7 +170,7 @@ class ChannelUserDictionary(UserDict.DictMixin): def __setitem__(self, (channel, id), v): if channel not in self.channels: - self.channels[channel] = {} + self.channels[channel] = self.IdDict() self.channels[channel][id] = v def __delitem__(self, (channel, id)):