From 5bcd98e1a4aa0b7f8d3d50adb659cb68d4262db6 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 5 Sep 2003 18:53:09 +0000 Subject: [PATCH] Finally found that crazy KeyError exception being raised, I think. --- plugins/Relay.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/Relay.py b/plugins/Relay.py index e7d7cfa43..d500324ef 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -127,7 +127,7 @@ class Relay(callbacks.Privmsg): self.whois = {} self.started = False self.ircstates = {} - self.lastmsg = ircmsgs.ping('this is just a fake message') + self.lastmsg = {} self.channels = ircutils.IrcSet() self.abbreviations = {} self.originalIrc = None @@ -135,12 +135,8 @@ class Relay(callbacks.Privmsg): def inFilter(self, irc, msg): if not isinstance(irc, irclib.Irc): irc = irc.getRealIrc() - try: - self.ircstates[irc].addMsg(irc, self.lastmsg) - except KeyError: - self.ircstates[irc] = irclib.IrcState() - self.ircstates[irc].addMsg(irc, self.lastmsg) - self.lastmsg = msg + self.ircstates[irc].addMsg(irc, self.lastmsg[irc]) + self.lastmsg[irc] = msg return msg def die(self): @@ -171,6 +167,8 @@ class Relay(callbacks.Privmsg): abbreviation = privmsgs.getArgs(args) self.ircs[abbreviation] = realIrc self.abbreviations[realIrc] = abbreviation + self.ircstates[realIrc] = irclib.IrcState() + self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message') self.started = True irc.reply(msg, conf.replySuccess) startrelay = privmsgs.checkCapability(startrelay, 'owner') @@ -198,6 +196,8 @@ class Relay(callbacks.Privmsg): newIrc.driver = driver self.ircs[abbreviation] = newIrc 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) relayconnect = privmsgs.checkCapability(relayconnect, 'owner')