From f2ae4b5f3424d4797defd9515aa82266ae28d221 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 4 Jun 2003 03:56:59 +0000 Subject: [PATCH] Finally found the underlying cause of the relaynames bug. --- src/irclib.py | 2 +- src/ircmsgs.py | 3 +++ src/ircutils.py | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/irclib.py b/src/irclib.py index 88557e4fb..7a4300050 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -296,7 +296,7 @@ class IrcState(IrcCommandDispatcher): chan.topic = msg.args[2] def doNick(self, irc, msg): - newNick = msg.args[0] + newNick = nick(msg.args[0]) oldNick = msg.nick try: if msg.user and msg.host: diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 92ee2afe5..37bff9ef5 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -79,7 +79,10 @@ class IrcMsg(object): self._user = user self._host = host self._command = command + if self.command == 'NICK': + self._args[0] = ircutils.nick(self._args[0]) self._args = tuple(args) + prefix = property(lambda self: self._prefix) nick = property(lambda self: self._nick) diff --git a/src/ircutils.py b/src/ircutils.py index 3ffa112fa..5b441430d 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -235,8 +235,15 @@ def shrinkList(L, sep='', limit=425): class nick(str): """This class does case-insensitive comparisons of nicks.""" def __init__(self, s): + self.original = s self.lowered = toLower(s) + def __repr__(self): + return repr(self.original) + + def __str__(self): + return str(self.original) + def __eq__(self, s): try: return toLower(s) == self.lowered