Finally found that crazy KeyError exception being raised, I think.

This commit is contained in:
Jeremy Fincher 2003-09-05 18:53:09 +00:00
parent 57146b93cf
commit 5bcd98e1a4

View File

@ -127,7 +127,7 @@ class Relay(callbacks.Privmsg):
self.whois = {} self.whois = {}
self.started = False self.started = False
self.ircstates = {} self.ircstates = {}
self.lastmsg = ircmsgs.ping('this is just a fake message') self.lastmsg = {}
self.channels = ircutils.IrcSet() self.channels = ircutils.IrcSet()
self.abbreviations = {} self.abbreviations = {}
self.originalIrc = None self.originalIrc = None
@ -135,12 +135,8 @@ class Relay(callbacks.Privmsg):
def inFilter(self, irc, msg): def inFilter(self, irc, msg):
if not isinstance(irc, irclib.Irc): if not isinstance(irc, irclib.Irc):
irc = irc.getRealIrc() irc = irc.getRealIrc()
try: self.ircstates[irc].addMsg(irc, self.lastmsg[irc])
self.ircstates[irc].addMsg(irc, self.lastmsg) self.lastmsg[irc] = msg
except KeyError:
self.ircstates[irc] = irclib.IrcState()
self.ircstates[irc].addMsg(irc, self.lastmsg)
self.lastmsg = msg
return msg return msg
def die(self): def die(self):
@ -171,6 +167,8 @@ class Relay(callbacks.Privmsg):
abbreviation = privmsgs.getArgs(args) abbreviation = privmsgs.getArgs(args)
self.ircs[abbreviation] = realIrc self.ircs[abbreviation] = realIrc
self.abbreviations[realIrc] = abbreviation self.abbreviations[realIrc] = abbreviation
self.ircstates[realIrc] = irclib.IrcState()
self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message')
self.started = True self.started = True
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
startrelay = privmsgs.checkCapability(startrelay, 'owner') startrelay = privmsgs.checkCapability(startrelay, 'owner')
@ -198,6 +196,8 @@ class Relay(callbacks.Privmsg):
newIrc.driver = driver newIrc.driver = driver
self.ircs[abbreviation] = newIrc self.ircs[abbreviation] = newIrc
self.abbreviations[newIrc] = abbreviation self.abbreviations[newIrc] = abbreviation
self.ircstates[newIrc] = irclib.IrcState()
self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message')
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relayconnect = privmsgs.checkCapability(relayconnect, 'owner') relayconnect = privmsgs.checkCapability(relayconnect, 'owner')