Fixed a few bugs arising from the switch to generic names.

This commit is contained in:
Jeremy Fincher 2003-10-21 07:19:53 +00:00
parent 7593ac1b8a
commit 3ac622ce11

View File

@ -120,9 +120,9 @@ def configure(onStart, afterConnect, advanced):
class Relay(callbacks.Privmsg): class Relay(callbacks.Privmsg):
def __init__(self): def __init__(self):
callbacks.Privmsg.__init__(self) callbacks.Privmsg.__init__(self)
self.color = 0
self.ircs = {} self.ircs = {}
self.whois = {} self._color = 0
self._whois = {}
self.started = False self.started = False
self.ircstates = {} self.ircstates = {}
self.lastmsg = {} self.lastmsg = {}
@ -345,7 +345,7 @@ class Relay(callbacks.Privmsg):
return return
otherIrc = self.ircs[network] otherIrc = self.ircs[network]
otherIrc.queueMsg(ircmsgs.whois(nick, nick)) otherIrc.queueMsg(ircmsgs.whois(nick, nick))
self.whois[(otherIrc, nick)] = (irc, msg, {}) self._whois[(otherIrc, nick)] = (irc, msg, {})
def color(self, irc, msg, args): def color(self, irc, msg, args):
"""<0,1,2> """<0,1,2>
@ -360,7 +360,7 @@ class Relay(callbacks.Privmsg):
color = int(privmsgs.getArgs(args)) color = int(privmsgs.getArgs(args))
if color != 0 and color != 1 and color != 2: if color != 0 and color != 1 and color != 2:
raise callbacks.ArgumentError raise callbacks.ArgumentError
self.color = color self._color = color
except ValueError: except ValueError:
raise callbacks.ArgumentError raise callbacks.ArgumentError
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
@ -370,10 +370,10 @@ class Relay(callbacks.Privmsg):
if not isinstance(irc, irclib.Irc): if not isinstance(irc, irclib.Irc):
irc = irc.getRealIrc() irc = irc.getRealIrc()
nick = ircutils.toLower(msg.args[1]) nick = ircutils.toLower(msg.args[1])
if (irc, nick) not in self.whois: if (irc, nick) not in self._whois:
return return
else: else:
self.whois[(irc, nick)][-1][msg.command] = msg self._whois[(irc, nick)][-1][msg.command] = msg
do312 = do311 do312 = do311
do317 = do311 do317 = do311
@ -383,9 +383,9 @@ class Relay(callbacks.Privmsg):
if not isinstance(irc, irclib.Irc): if not isinstance(irc, irclib.Irc):
irc = irc.getRealIrc() irc = irc.getRealIrc()
nick = ircutils.toLower(msg.args[1]) nick = ircutils.toLower(msg.args[1])
if (irc, nick) not in self.whois: if (irc, nick) not in self._whois:
return return
(replyIrc, replyMsg, d) = self.whois[(irc, nick)] (replyIrc, replyMsg, d) = self._whois[(irc, nick)]
hostmask = '@'.join(d['311'].args[2:4]) hostmask = '@'.join(d['311'].args[2:4])
user = d['311'].args[-1] user = d['311'].args[-1]
if '319' in d: if '319' in d:
@ -414,15 +414,15 @@ class Relay(callbacks.Privmsg):
s = '%s (%s) has been on server %s since %s (idle for %s) and %s.' % \ s = '%s (%s) has been on server %s since %s (idle for %s) and %s.' % \
(user, hostmask, server, signon, idle, channels) (user, hostmask, server, signon, idle, channels)
replyIrc.reply(replyMsg, s) replyIrc.reply(replyMsg, s)
del self.whois[(irc, nick)] del self._whois[(irc, nick)]
def do402(self, irc, msg): def do402(self, irc, msg):
if not isinstance(irc, irclib.Irc): if not isinstance(irc, irclib.Irc):
irc = irc.getRealIrc() irc = irc.getRealIrc()
nick = ircutils.toLower(msg.args[1]) nick = ircutils.toLower(msg.args[1])
if (irc, nick) not in self.whois: if (irc, nick) not in self._whois:
return return
(replyIrc, replyMsg, d) = self.whois[(irc, nick)] (replyIrc, replyMsg, d) = self._whois[(irc, nick)]
s = 'There is no %s on %s.' % (nick, self.abbreviations[irc]) s = 'There is no %s on %s.' % (nick, self.abbreviations[irc])
replyIrc.reply(replyMsg, s) replyIrc.reply(replyMsg, s)
@ -430,18 +430,18 @@ class Relay(callbacks.Privmsg):
def _formatPrivmsg(self, nick, network, msg): def _formatPrivmsg(self, nick, network, msg):
# colorize nicks # colorize nicks
if self.color >= 1: if self._color >= 1:
nick = ircutils.mircColor(nick, *ircutils.canonicalColor(nick)) nick = ircutils.mircColor(nick, *ircutils.canonicalColor(nick))
if self.color >= 2: if self._color >= 2:
colors = ircutils.canonicalColor(nick, shift=4) colors = ircutils.canonicalColor(nick, shift=4)
if ircmsgs.isAction(msg): if ircmsgs.isAction(msg):
if self.color >= 2: if self._color >= 2:
t = ircutils.mircColor('*', *colors) t = ircutils.mircColor('*', *colors)
else: else:
t = '*' t = '*'
s = '%s %s@%s %s' % (t, nick, network, ircmsgs.unAction(msg)) s = '%s %s@%s %s' % (t, nick, network, ircmsgs.unAction(msg))
else: else:
if self.color >= 2: if self._color >= 2:
lt = ircutils.mircColor('<', *colors) lt = ircutils.mircColor('<', *colors)
gt = ircutils.mircColor('>', *colors) gt = ircutils.mircColor('>', *colors)
else: else: