Changed some mircColor stuff.

This commit is contained in:
Jeremy Fincher 2003-07-23 15:24:05 +00:00
parent 7c34d8b449
commit 5644c8da57
2 changed files with 8 additions and 6 deletions

View File

@ -261,15 +261,15 @@ class Relay(callbacks.Privmsg):
def _formatPrivmsg(self, nick, abbreviation, msg): def _formatPrivmsg(self, nick, abbreviation, msg):
# colorize nicks # colorize nicks
color_index = (hash(nick) % 14) + 2 colorNumber = (hash(nick) % 14) + 2
color = ircutils._colors.keys()[color_index]
if ircmsgs.isAction(msg): if ircmsgs.isAction(msg):
return '* %s@%s %s' % \ return '* %s@%s %s' % \
(ircutils.mircColor(nick, color), abbreviation, (ircutils.mircColor(nick, colorNumber), abbreviation,
ircmsgs.unAction(msg)) ircmsgs.unAction(msg))
else: else:
return '<%s@%s> %s' % \ return '<%s@%s> %s' % \
(ircutils.mircColor(nick, color), abbreviation, msg.args[1]) (ircutils.mircColor(nick, colorNumber),
abbreviation, msg.args[1])
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
callbacks.Privmsg.doPrivmsg(self, irc, msg) callbacks.Privmsg.doPrivmsg(self, irc, msg)

View File

@ -217,9 +217,11 @@ mircColors = {
'light grey': '15', 'light grey': '15',
} }
# Now add the reverse to the dictionary.
for (k, v) in mircColors.items(): for (k, v) in mircColors.items():
mircColors[int(v)] = k if v: # Ignore empty string for None.
i = int(v)
mircColors[v] = i
mircColors[i] = i
def mircColor(s, fg=None, bg=None): def mircColor(s, fg=None, bg=None):
"""Returns s, with the appropriate mIRC color codes applied.""" """Returns s, with the appropriate mIRC color codes applied."""