From ad3fb443a6bfa078a9c2def1975fd95bae53b0f0 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 30 Jul 2003 11:04:59 +0000 Subject: [PATCH] Bugfix in mircColor. --- src/ircutils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ircutils.py b/src/ircutils.py index ed3a961ae..4309d6432 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -225,14 +225,17 @@ def mircColor(s, fg=None, bg=None): """Returns s, with the appropriate mIRC color codes applied.""" if fg is None and bg is None: return s - fg = mircColors[fg] + if fg is None or isinstance(fg, str): + fg = mircColors[fg] if bg is None: return '\x03%s%s\x03' % (fg, s) else: if isinstance(bg, str): bg = mircColors[bg] return '\x03%s,%s%s\x03' % (fg, bg, s) - + +def canonicalColor(s): + return mircColor(s, hash(s) % 14 + 2) def isValidArgument(s): """Returns if s is strictly a valid argument for an IRC message."""