Added proper NICK handling to IrcState

This commit is contained in:
Jeremy Fincher 2003-03-31 08:12:50 +00:00
parent 534c367b89
commit 68440bd83a

View File

@ -73,7 +73,7 @@ class IrcCallback(object):
method = getattr(self, commandName) method = getattr(self, commandName)
try: try:
method(irc, msg) method(irc, msg)
except Exception, e: except Exception:
debug.recoverableException() debug.recoverableException()
s = 'Exception raised by %s.%s' % \ s = 'Exception raised by %s.%s' % \
(self.__class__.__name__, method.im_func.func_name) (self.__class__.__name__, method.im_func.func_name)
@ -224,6 +224,15 @@ class IrcState(object):
channel = msg.args[1].lower() channel = msg.args[1].lower()
chan = self.channels[channel] chan = self.channels[channel]
chan.topic = msg.args[2] chan.topic = msg.args[2]
elif msg.command == 'NICK':
newNick = msg.args[0]
for channel in self.channels.itervalues():
chan = self.channels[channel]
for s in (chan.users, chan.ops, chan.halfops, chan.voices):
if msg.nick in s:
s.remove(msg.nick)
s.add(newNick)
def getTopic(self, channel): def getTopic(self, channel):
return self.channels[channel.lower()].topic return self.channels[channel.lower()].topic