Fixed some uncaught exceptions and a few other places it might happen.

This commit is contained in:
Jeremy Fincher 2004-11-07 20:40:49 +00:00
parent ced5caa68f
commit 2633575d9a

View File

@ -366,17 +366,18 @@ class Relay(callbacks.Privmsg):
def punish(): def punish():
punished = False punished = False
for irc in world.ircs: for irc in world.ircs:
if irc.nick in irc.state.channels[channel].ops: if channel in irc.state.channels:
self.log.info('Punishing %s in %s on %s for relaying.', if irc.nick in irc.state.channels[channel].ops:
msg.prefix, channel, irc.network) self.log.info('Punishing %s in %s on %s for relaying.',
irc.sendMsg(ircmsgs.ban(channel, msg.prefix)) msg.prefix, channel, irc.network)
kmsg = 'You seem to be relaying, punk.' irc.sendMsg(ircmsgs.ban(channel, msg.prefix))
irc.sendMsg(ircmsgs.kick(channel, msg.nick, kmsg)) kmsg = 'You seem to be relaying, punk.'
punished = True irc.sendMsg(ircmsgs.kick(channel, msg.nick, kmsg))
else: punished = True
self.log.warning('Can\'t punish %s in %s on %s; ' else:
'I\'m not opped.', self.log.warning('Can\'t punish %s in %s on %s; '
msg.prefix, channel, irc.network) 'I\'m not opped.',
msg.prefix, channel, irc.network)
return punished return punished
if channel not in self.last20Privmsgs: if channel not in self.last20Privmsgs:
self.last20Privmsgs[channel] = RingBuffer(20) self.last20Privmsgs[channel] = RingBuffer(20)
@ -481,9 +482,10 @@ class Relay(callbacks.Privmsg):
network = self._getIrcName(irc) network = self._getIrcName(irc)
s = 'nick change by %s to %s on %s' % (msg.nick, newNick, network) s = 'nick change by %s to %s on %s' % (msg.nick, newNick, network)
for channel in self.registryValue('channels'): for channel in self.registryValue('channels'):
if newNick in irc.state.channels[channel].users: if channel in irc.state.channels:
m = ircmsgs.privmsg(channel, s) if newNick in irc.state.channels[channel].users:
self._sendToOthers(irc, m) m = ircmsgs.privmsg(channel, s)
self._sendToOthers(irc, m)
def doTopic(self, irc, msg): def doTopic(self, irc, msg):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)