irclib: Prevent crash if 324 or 329 is not received after any other post-join messages.

This commit is contained in:
Valentin Lorentz 2013-10-10 14:10:06 +00:00
parent 359d3c633d
commit 677f7fdd6f

View File

@ -532,7 +532,11 @@ class IrcState(IrcCommandDispatcher):
def do324(self, irc, msg):
channel = msg.args[1]
try:
chan = self.channels[channel]
except KeyError:
chan = ChannelState()
self.channels[channel] = chan
for (mode, value) in ircutils.separateModes(msg.args[2:]):
modeChar = mode[1]
if mode[0] == '+' and mode[1] not in 'ovh':
@ -543,7 +547,11 @@ class IrcState(IrcCommandDispatcher):
def do329(self, irc, msg):
# This is the last part of an empty mode.
channel = msg.args[1]
try:
chan = self.channels[channel]
except KeyError:
chan = ChannelState()
self.channels[channel] = chan
chan.created = int(msg.args[2])
def doPart(self, irc, msg):