From ea3e606d473fb9906f956fcdcd51a4ab8102887f Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sat, 1 Jan 2011 14:47:29 +0000 Subject: fix /recolor with the new nick_color method --- src/message.py | 5 +++-- src/room.py | 2 +- src/windows.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/message.py b/src/message.py index 67183678..004111d7 100644 --- a/src/message.py +++ b/src/message.py @@ -26,7 +26,7 @@ class Message(object): The color can be a single number OR a list of numbers, for specials cases like join or quit messages. """ - def __init__(self, txt, time=None, nickname=None, nick_color=None, color=None, colorized=False): + def __init__(self, txt, time=None, nickname=None, nick_color=None, color=None, colorized=False, user=None): """ time is a datetime object, None means 'now'. If no nickname is specified, it's an information. @@ -37,9 +37,10 @@ class Message(object): self.nick_color = nick_color self.color = color self.colorized = colorized + self.user = user def __repr__(self): - return "" % (self.txt, self.nickname, str(self.time), str(self.nick_color), self.colorized) + return "" % (self.txt, self.nickname, str(self.time), str(self.user), self.colorized) def __str__(self): return self.__repr__() diff --git a/src/room.py b/src/room.py index 8004d597..f263aef5 100644 --- a/src/room.py +++ b/src/room.py @@ -117,7 +117,7 @@ class Room(TextBuffer): color = theme.COLOR_INFORMATION_TEXT time = time if time is not None else datetime.now() nick_color = nick_color or user.color if user else None - message = Message(txt, time, nickname, nick_color, color, colorized) + message = Message(txt, time, nickname, nick_color, color, colorized, user=user) while len(self.messages) > MESSAGE_NB_LIMIT: self.messages.pop(0) self.messages.append(message) diff --git a/src/windows.py b/src/windows.py index 3a2b5905..df3d40e2 100644 --- a/src/windows.py +++ b/src/windows.py @@ -470,7 +470,7 @@ class TextWin(Win): else: limit = self.width-offset-1 this_line_was_broken_by_space = False - color = message.nick_color + color = message.user.color if message.user else message.nick_color if not first: nick = None time = None -- cgit v1.2.3