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):
# colorize nicks
color_index = (hash(nick) % 14) + 2
color = ircutils._colors.keys()[color_index]
colorNumber = (hash(nick) % 14) + 2
if ircmsgs.isAction(msg):
return '* %s@%s %s' % \
(ircutils.mircColor(nick, color), abbreviation,
(ircutils.mircColor(nick, colorNumber), abbreviation,
ircmsgs.unAction(msg))
else:
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):
callbacks.Privmsg.doPrivmsg(self, irc, msg)

View File

@ -217,9 +217,11 @@ mircColors = {
'light grey': '15',
}
# Now add the reverse to the dictionary.
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):
"""Returns s, with the appropriate mIRC color codes applied."""